QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#273063#5422. Perfect PalindromeYcfhnndCompile Error//C++20438b2023-12-02 21:04:102023-12-02 21:05:02

Judging History

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

  • [2023-12-02 21:05:02]
  • 评测
  • [2023-12-02 21:04:10]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

using i64 = long long;

void solve(){
    string s;
    cin >> s;
    vector<int>cnt(26);
    for (auto c : s){
        cnt[c - 'a'] ++;
    }
    cout << n - *max_element(cnt.begin(), cnt.end()) << "\n";
}

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

    int T = 1;
    cin >> T;
    while (T --){
        solve();
    }
    return 0;
}

Details

answer.code: In function ‘void solve()’:
answer.code:14:13: error: ‘n’ was not declared in this scope
   14 |     cout << n - *max_element(cnt.begin(), cnt.end()) << "\n";
      |             ^