結果

問題 No.706 多眼生物の調査
ユーザー furafura
提出日時 2020-04-12 02:33:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 324 bytes
コンパイル時間 2,183 ms
コンパイル使用メモリ 202,220 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-21 13:23:28
合計ジャッジ時間 2,998 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 3 ms
4,348 KB
testcase_05 AC 5 ms
4,348 KB
testcase_06 AC 11 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function 'int main()':
main.cpp:17:13: warning: 'ans' may be used uninitialized [-Wmaybe-uninitialized]
   17 |         int ans;
      |             ^~~

ソースコード

diff #

#include <bits/stdc++.h>

#define rep(i,n) for(int i=0;i<(n);i++)

using namespace std;

int main(){
	int n; scanf("%d",&n);

	int hist[1000]={};
	rep(i,n){
		string s; cin>>s;
		hist[s.length()-2]++;
	}
	int mx=*max_element(hist,hist+1000);

	int ans;
	rep(i,1000) if(hist[i]==mx) ans=i;
	printf("%d\n",ans);

	return 0;
}
0