Run ID 作者 问题 语言 测评结果 Time Memory 代码长度 提交时间
133573 aaa114 晚餐 C++ Compile Error 0 MS 0 KB 742 2025-10-19 16:20:53

Tests(0/0):


Code:

#include <iostream> #include <string> #include <vector> #include <unordered_set> using namespace std; int main() { // 合法餐具集合 unordered_set<string> valid = {"bowl", "knife", "fork", "chopsticks"}; int n; // 多组测试数据 while (cin >> n) { vector<string> utensils; for (int i = 0; i < n; ++i) { string item; cin >> item; if (valid.count(item)) { utensils.push_back(item); } } // 输出结果 for (size_t i = 0; i < utensils.size(); ++i) { if (i > 0) cout << " "; cout << utensils[i]; } cout << endl; } return 0; }


Run Info:

Main.cc:8:1: error: stray '\357' in program
 int main() {
 ^
Main.cc:8:1: error: stray '\274' in program
Main.cc:8:1: error: stray '\210' in program
Main.cc:8:1: error: stray '\357' in program
Main.cc:8:1: error: stray '\274' in program
Main.cc:8:1: error: stray '\211' in program
Main.cc:10:27: error: expected primary-expression before 'valid'
     unordered_set valid = {"bowl", "knife", "fork", "chopsticks"};
                           ^
Main.cc:10:27: error: expected '}' before 'valid'
Main.cc:10:27: error: expected ',' or ';' before 'valid'
Main.cc:14:5: error: expected unqualified-id before 'while'
     while (cin >> n) {
     ^