結果
問題 |
No.706 多眼生物の調査
|
ユーザー |
|
提出日時 | 2019-07-01 20:29:14 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 333 bytes |
コンパイル時間 | 602 ms |
コンパイル使用メモリ | 70,916 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-18 05:19:56 |
合計ジャッジ時間 | 1,058 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 5 |
コンパイルメッセージ
main.cpp: In function 'int main()': main.cpp:19:11: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized] 19 | cout << ans << endl; | ^~~ main.cpp:6:21: note: 'ans' was declared here 6 | int n,a[1001]={0},ans,M=0; | ^~~
ソースコード
#include<iostream> #include<algorithm> #include<cmath> using namespace std; int main() { int n,a[1001]={0},ans,M=0; string s; cin >> n; for(int i=0; i<n; i++) { cin >> s; a[s.size()]++; } for(int i=0; i<1001; i++) { if(a[i]>=M) { M=a[i]; ans=i-2; } } cout << ans << endl; }