Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
56219 | zhangweiran | 垃圾分类 | C++ | 通过 | 1 MS | 244 KB | 700 | 2024-11-09 22:14:32 |
#include<bits/stdc++.h> using namespace std; string a[4][4]={{"FOOD WASTE","leaves","watermelon peel","leftovers"}, {"RECYCLABLE","paper box","plastic bottle","clothes"}, {"HAZARDOUS","rechargeable battery","abandoned medicine","disinfectant"}, {"RESIDUAL WASTE","mask","battery","plastic bag"}}; string r[20]; int each[4]; int n,maxn=0; int main() { cin>>n; char ch=cin.get(); for(int i=0;i<n;i++){ getline(cin,r[i]); } for(int i=0;i<n;i++){ for(int j=0;j<4;j++){ if(r[i]==a[j][1]||r[i]==a[j][2]||r[i]==a[j][3]){ each[j]++; } } } for(int i=1;i<4;i++){ if(each[i]>each[maxn]){ maxn=i; } } cout<<a[maxn][0]<<endl<<each[maxn]; }