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; }Pascal :
var s:string; i,j,mt,qc,n:longint; begin readln(n); for i:=1 to n do begin readln(s); if (s[1]='1') and (s[2] in ['Y','E','X']) then inc(mt) else if (s[1]='2') and (s[2] in ['Y','E','X']) then inc(qc); end; write(mt,' ',qc) end.
- 1
Information
- ID
- 16615
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By