| Run ID | 作者 | 问题 | 语言 | 测评结果 | 时间 | 内存 | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 80774 | sh25_wangtaojie | 垃圾分类 | C++ | 解答错误 | 0 MS | 256 KB | 1157 | 2026-01-04 15:31:03 |
#include <iostream> #include <unordered_map> #include <string> using namespace std; int main() { int N; cin >> N; unordered_map<string, int> categoryCount; unordered_map<string, string> categoryMap = { {"leaves", "FOOD WASTE"}, {"watermelon peel", "FOOD WASTE"}, {"leftovers", "FOOD WASTE"}, {"paper box", "RECYCLABLE"}, {"plastic bottle", "RECYCLABLE"}, {"clothes", "RECYCLABLE"}, {"rechargeable battery", "HAZARDOUS"}, {"abandoned medicine", "HAZARDOUS"}, {"disinfectant", "HAZARDOUS"}, {"mask", "RESIDUAL WASTE"}, {"battery", "RESIDUAL WASTE"}, {"plastic bag", "RESIDUAL WASTE"} }; for (int i = 0; i < N; ++i) { string item; cin >> item; if (categoryMap.count(item)) { categoryCount[categoryMap[item]]++; } } string maxCategory; int maxCount = 0; for (const auto& pair : categoryCount) { if (pair.second > maxCount) { maxCount = pair.second; maxCategory = pair.first; } } cout << maxCategory << endl; cout << maxCount << endl; return 0; }