結果

問題 No.79 過小評価ダメ・ゼッタイ
ユーザー mosmos_21
提出日時 2016-10-05 23:55:51
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 10 ms / 5,000 ms
コード長 264 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 21,120 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-26 08:03:53
合計ジャッジ時間 1,140 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 22
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:4:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    4 |   scanf("%d",&n);
      |   ^~~~~~~~~~~~~~
main.c:5:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    5 |   for(;i<n;i++) scanf("%d", &h[i]);
      |                 ^~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
int main(){
  int n, h[100000],l[6]={0},ml=1,m,i=0;
  scanf("%d",&n);
  for(;i<n;i++) scanf("%d", &h[i]);
  for(;i;i--)l[h[i-1]-1]++;
  m=l[0];
  for(;i<6;i++)
    if(l[i]>=m){
      m=l[i];
      ml=i+1;
    }
  printf("%d\n",ml);
  return 0;
}
0