Run ID 作者 问题 语言 测评结果 时间 内存 代码长度 提交时间
42295 YOYOLEE-李昕颖 垃圾分类 C++ 解答错误 0 MS 240 KB 734 2024-02-25 10:45:56

Tests(0/1):


#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[4]; 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; }


测评信息: