結果
| 問題 | No.706 多眼生物の調査 | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2018-07-06 10:07:55 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 11 ms / 2,000 ms | 
| コード長 | 383 bytes | 
| コンパイル時間 | 543 ms | 
| コンパイル使用メモリ | 63,532 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-07-01 02:43:43 | 
| 合計ジャッジ時間 | 1,050 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 5 | 
コンパイルメッセージ
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;
}
            
            
            
        