Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|
42297 | YOYOLEE-李昕颖 | 垃圾分类 | C++ | 通过 | 1 MS | 260 KB | 735 | 2024-02-25 10:47:07 |
#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[25]; int each[4]; int n,maxn; 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][3]||r[i]==a[j][2]){ each[j]++; } } } for(int i=1;i<4;i++){ if(each[i]>each[maxn]){ maxn=i; } } cout<<a[maxn][0]<<endl<<each[maxn]; return 0; }