QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#578196#9320. Find the Easiest ProblemfyCompile Error//C++14703b2024-09-20 17:15:542024-09-20 17:15:55

Judging History

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

  • [2024-09-20 17:15:55]
  • 评测
  • [2024-09-20 17:15:54]
  • 提交

answer

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


void solve()
{
    int n;cin>>n;
    while(n --)
    {
        int cnt[26] = {0};
        set<string> S[26];
        string a, b, c;
        cin>>a>>b>>c;
        if(c[0] == 'r')continue;
        if(!S[b[0] - 'A'].count(a))cnt[b[0] - 'A'] ++;
        S[b[0] - 'A'].insert(a);
    }
    int id, mx = 0;
    for(int i = 0; i < 26; i ++)
    {
        if(cnt[i] > mx)
        {
            mx = cnt[i];
            id = i;
        }
    }
    char ans = 'A' + id;
    cout<<ans<<endl;
}

int main()
{
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int t;cin>>t;
    while(t --)
        solve();
    return 0;
}

Details

answer.code: In function ‘void solve()’:
answer.code:21:12: error: ‘cnt’ was not declared in this scope; did you mean ‘int’?
   21 |         if(cnt[i] > mx)
      |            ^~~
      |            int