結果

問題 No.706 多眼生物の調査
ユーザー KhiromuKhiromu
提出日時 2018-06-29 22:25:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 637 bytes
コンパイル時間 479 ms
コンパイル使用メモリ 65,696 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-13 15:20:24
合計ジャッジ時間 1,106 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>

using namespace std;
#define CK(N, A, B) (A <= N && N < B)
#define REP(i, a, b) for (int i = a; i < b; i++)
#define RREP(i, a, b) for (int i = (b - 1); a <= i; i--)
#define F first
#define S second
typedef long long ll;

const int INF = 1e9 + 7;
const long long LLINF = 1e18;

int n;
int eye[1001];
int main() {
    cin>>n;

    REP(i, 0, n){
        string s;
        cin>>s;
        eye[s.size()-2]++;
    }

    int mx=0;
    int num;
    REP(i, 0, 1001){
        if(mx<=eye[i]){
            mx=eye[i];
            num=i;
        }
    }
    cout<<num<<endl;
    return 0;
}
0