結果

問題 No.706 多眼生物の調査
ユーザー face4face4
提出日時 2018-07-06 10:07:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 382 bytes
コンパイル時間 634 ms
コンパイル使用メモリ 64,912 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-13 18:04:41
合計ジャッジ時間 1,220 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 5 ms
4,376 KB
testcase_06 AC 9 ms
4,380 KB
testcase_07 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:25:13: 警告: ‘ans’ may be used uninitialized [-Wmaybe-uninitialized]
   25 |     cout << ans << endl;
      |             ^~~
main.cpp:17:9: 備考: ‘ans’ はここで定義されています
   17 |     int ans;
      |         ^~~

ソースコード

diff #

#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;
}
0