結果

問題 No.706 多眼生物の調査
ユーザー beginner_progbeginner_prog
提出日時 2018-07-13 20:40:38
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 386 bytes
コンパイル時間 1,317 ms
コンパイル使用メモリ 158,064 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 11:04:03
合計ジャッジ時間 1,822 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 WA -
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 5 ms
5,376 KB
testcase_06 AC 10 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:21:13: warning: ‘key’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   21 |     cout << key << endl;
      |             ^~~

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int a[1000];
int main(){
    int max = 0;
    int n;
    string s;
    cin >> n;
    int key;
    for(int i=0;i<n;i++){
        cin >> s;
        a[s.size()-2]++;
    }
    for(int i=0;i<n;i++){
        if(max<=a[i]){
            key = i;
            max = a[i];
        }
    }
    cout << key << endl;
    return 0;
}
0