| Run ID | 作者 | 问题 | 语言 | 测评结果 | Time | Memory | 代码长度 | 提交时间 |
|---|---|---|---|---|---|---|---|---|
| 82074 | 陈俊洁 | 统计字符数量 | C++ | Compile Error | 0 MS | 0 KB | 279 | 2024-07-12 17:02:20 |
#include<bits/stdc++.h> using namespace std; char s[1000000]; int sn[150]; int main() { cin>>s; int s_l=strlen(s); for(int i=0;i<s_l;i++){ sn[s[i]]++; } for(int j='a';j<='z';j++){ if(max<sn[j]){ max=sn[j]; k=j; } } cout<<char(k)<<' '<<max; }
Main.cc: In function 'int main()':
Main.cc:9:10: warning: array subscript has type 'char' [-Wchar-subscripts]
sn[s[i]]++;
^
Main.cc:12:14: error: the value of 'sn' is not usable in a constant expression
if(max