結果

問題 No.706 多眼生物の調査
ユーザー CleyLCleyL
提出日時 2019-04-26 14:20:27
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 9 ms / 2,000 ms
コード長 302 bytes
コンパイル時間 478 ms
コンパイル使用メモリ 51,728 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-15 23:32:03
合計ジャッジ時間 1,467 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
using namespace std;
int a[1001];
int main(){
  int n;cin>>n;
  for(int i = 0; n > i; i++){
    string s;cin>>s;
    a[s.size()]++;
  }
  int mx = 0;
  int mxp;
  for(int i = 0; 1001 > i; i++){
    if(mx <= a[i]){
      mxp = i-2;
      mx = a[i];
    }
  }
  cout << mxp << endl;
}
0