QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#190629#5422. Perfect PalindromeSoyTonyCompile Error//C++14421b2023-09-29 08:49:212023-09-29 08:49:21

Judging History

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

  • [2023-09-29 08:49:21]
  • 评测
  • [2023-09-29 08:49:21]
  • 提交

answer

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

const int maxn=1e5+10;

int t;
int n;
char s[maxn]
mp<char,int> mp;

int main(){
    scanf("%d",&t);
    while(t--){
        scanf("%s",s+1);
        n=strlen(s+1);
        mp.clear();
        int mx=0;
        for(int i=1;i<=n;++i){
            ++mp[s[i]];
            mx=max(mx,mp[s[i]]);
        }
        printf("%d\n",n-mx);
    }
    return 0;
}

詳細信息

answer.code:9:1: error: expected initializer before ‘mp’
    9 | mp<char,int> mp;
      | ^~
answer.code: In function ‘int main()’:
answer.code:14:20: error: ‘s’ was not declared in this scope
   14 |         scanf("%s",s+1);
      |                    ^
answer.code:16:9: error: ‘mp’ was not declared in this scope
   16 |         mp.clear();
      |         ^~
answer.code:12:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   12 |     scanf("%d",&t);
      |     ~~~~~^~~~~~~~~