結果
| 問題 |
No.706 多眼生物の調査
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-07-06 10:07:16 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 382 bytes |
| コンパイル時間 | 491 ms |
| コンパイル使用メモリ | 63,672 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-07-01 02:43:30 |
| 合計ジャッジ時間 | 1,056 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 4 WA * 1 |
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:25:13: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
25 | cout << ans << endl;
| ^~~
main.cpp:17:9: note: 'ans' was declared here
17 | int ans;
| ^~~
ソースコード
#include<iostream>
using namespace std;
int main(){
int n;
int A[1000] = {};
string x;
cin >> n;
while(n-- > 0){
cin >> x;
A[x.length()-2]++;
}
int mode = -1;
int ans;
for(int i = 998; i > 0; i--){
if(A[i] > mode){
mode = A[i];
ans = i;
}
}
cout << ans << endl;
return 0;
}