結果

問題 No.706 多眼生物の調査
ユーザー xueleixuelei
提出日時 2018-07-21 18:41:07
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 286 bytes
コンパイル時間 1,612 ms
コンパイル使用メモリ 51,808 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-27 00:41:53
合計ジャッジ時間 1,328 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 2 ms
4,376 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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=1;i<1001;i++){
    if(a[i]>most){most=a[i];m=i;}
  }
  cout << m << endl;
  return 0;
}
0