結果
問題 | No.79 過小評価ダメ・ゼッタイ |
ユーザー |
![]() |
提出日時 | 2017-06-27 15:46:40 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 9 ms / 5,000 ms |
コード長 | 385 bytes |
コンパイル時間 | 118 ms |
コンパイル使用メモリ | 22,528 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 08:14:41 |
合計ジャッジ時間 | 937 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
コンパイルメッセージ
main.cpp:2:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type] 2 | main(){ | ^~~~ main.cpp: In function ‘int main()’: main.cpp:5:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 5 | scanf("%d",&N); | ~~~~~^~~~~~~~~ main.cpp:8:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 8 | scanf("%d",&l); | ~~~~~^~~~~~~~~
ソースコード
#include<stdio.h> main(){ int N; int count[] = {0,0,0,0,0,0}; scanf("%d",&N); for(int i = 0;i < N;i++){ int l; scanf("%d",&l); count[l-1]++; } int max = 0; int maxindex = 0; for(int i = 0;i < 6;i++){ if(count[i] >= max){ max = count[i]; maxindex = i+1; } } printf("%d",maxindex); }