結果

問題 No.706 多眼生物の調査
ユーザー xueleixuelei
提出日時 2018-07-21 18:44:31
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 287 bytes
コンパイル時間 353 ms
コンパイル使用メモリ 52,024 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-27 00:42:00
合計ジャッジ時間 914 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
using namespace std;

int main(){
  int n;
  cin >> n;
  int a[1001]={};
  string s;
  for(int i=0;i<n;i++){
    cin >> s;
    a[s.size()-2]++;
  }

  int most=0,m;

  for(int i=0;i<1001;i++){
    if(a[i]>=most){most=a[i];m=i;}
  }
  cout << m << endl;
  return 0;
}
0