Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
102451 | 罗迎甲 | 19选班长II | C++ | Compile Error | 0 MS | 0 KB | 939 | 2024-12-21 16:39:50 |
#include<iostream> // cin\cout\endl #include<cstdio> //scanf()\printf() #include<cstring> // strcpy()\strcat()\strcmp()\strlen()\memset() #include<cmath> //sqrt()\pow()\abs()\ceil()\floor()\max()\min() using namespace std; int main(){ int x=0,n=0,b=0,A=0,B=0,C=0; cin>>n; int a[10001]={0}; while(1){ cin>>a[x]; if(a[x]==-1) break; x++; n++; } for(x=0;x<n;x++) { if(a[x]==1) A++; else if(a[x]==2) B++; else if(a[x]==3) C++; } for(int z=1;z<=n;z++) { cout<<"A="<<A<<endl; cout<<"B="<<B<<endl; cout<<"C="<<C<<endl; cout<<"Tot="<<n<<endl; if(A>n/2) cout<<"A-yes"<<endl; else if(B>n/2) cout<<"B-yes"<<endl; else if(C>n/2) cout<<"C-yes"<<endl; else cout<<"all-NO"<<endl; return 0; }
Main.cc: In function 'int main()': Main.cc:8:17: warning: unused variable 'b' [-Wunused-variable] int x=0,n=0,b=0,A=0,B=0,C=0; ^ Main.cc:44:1: error: expected '}' at end of input } ^