1 solutions
-
0
C :
#include<stdio.h> int main(){ int x[3]={0},n,i,cc,t; char c; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d%c%d",&cc,&c,&t); if(c=='Y'||c=='E'||c=='X') x[cc]++; } printf("%d %d\n",x[1],x[2]); return 0; }
C++ :
#include <iostream> using namespace std; string str; int numa,numb; void init() { numa=0; numb=0; } int main() { int n; while(cin>>n) { init(); for(int i=0;i<n;i++) { cin>>str; if(str[0]=='1'&&(str[1]=='Y'||str[1]=='E'||str[1]=='X')) { numa++; } if(str[0]=='2'&&(str[1]=='Y'||str[1]=='E'||str[1]=='X')) { numb++; } } cout<<numa<<" "<<numb<<endl; } return 0; }
- 1
Information
- ID
- 10137
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By