結果

問題 No.706 多眼生物の調査
ユーザー Khiromu
提出日時 2018-06-29 22:25:46
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 12 ms / 2,000 ms
コード長 637 bytes
コンパイル時間 658 ms
コンパイル使用メモリ 67,904 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-06-30 23:56:18
合計ジャッジ時間 1,053 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:35:11: warning: 'num' may be used uninitialized [-Wmaybe-uninitialized]
   35 |     cout<<num<<endl;
      |           ^~~
main.cpp:28:9: note: 'num' was declared here
   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