| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 131236 | 郑景文 | 统计字符数量 | C++ | Compile Error | 0 MS | 0 KB | 310 | 2025-09-21 15:22:12 |
#include<bits/stdc++.h> using namespace std; int b[123]; int main(){ char a[1000]; cin>>a; for(int i=0;i<1000;i++){ if(a[i]=='\0')break; b[a[i]]++; } int max=0,max_i=-1; for(int i=97;i=123;i++){ if(b[i]>max){ max=b[i]; max_i=i } } cout<<char(max_i)<<" "<<max; }
Main.cc: In function 'int main()':
Main.cc:12:9: warning: array subscript has type 'char' [-Wchar-subscripts]
b[a[i]]++;
^
Main.cc:15:17: warning: suggest parentheses around assignment used as truth value [-Wparentheses]
for(int i=97;i=123;i++){
^
Main.cc:19:3: error: expected ';' before '}' token
}
^