Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
78520 李君彦666 19选班长II C++ Accepted 1 MS 272 KB 518 2024-06-22 15:29:48

Tests(10/10):


Code:

#include <iostream> using namespace std; int main(){ int a[100] = {0}, n, s,tot = 0; double half = 0.0; while(1){ cin>>s; if(s == -1){ break; } a[s]++; tot++; } cout << "A="<<a[1]<<endl; cout << "B="<<a[2]<<endl; cout << "C="<<a[3]<<endl; cout<<"Tot="<<tot<<endl; half = 1.0*tot/2; if(a[1]>half) cout <<"A-yes"<<endl; else if(a[2]>half) cout << "B-yes"<<endl; else if (a[3]>half){ cout << "C-yes"<<endl; } else{ cout << "all-NO"<<endl; } }