QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#637175#7879. Colorful Balloonsfoolnine#Compile Error//C++20500b2024-10-13 10:37:292024-10-13 10:37:29

Judging History

你现在查看的是最新测评结果

  • [2024-10-13 10:37:29]
  • 评测
  • [2024-10-13 10:37:29]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

using i64 = long long;

int main(void)
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;

    map<string, int> mp;
    for (int i = 0; i < n; i++) {
        string s;
        cin >> s;

        mp[s]++;
    }

    string ans = "uh-oh";
    for (auto [x, y] : mp) {
        if (2 * y > n) {
            ans = x;
            cnt++;
        }
    }

    cout << ans << endl;

    return 0;
}

详细

answer.code: In function ‘int main()’:
answer.code:26:13: error: ‘cnt’ was not declared in this scope; did you mean ‘int’?
   26 |             cnt++;
      |             ^~~
      |             int