結果

問題 No.706 多眼生物の調査
ユーザー 👑 CleyL
提出日時 2019-04-26 14:20:27
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 302 bytes
コンパイル時間 428 ms
コンパイル使用メモリ 54,648 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-24 08:57:12
合計ジャッジ時間 1,112 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 5
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:18:11: warning: ‘mxp’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   18 |   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