結果
問題 | No.79 過小評価ダメ・ゼッタイ |
ユーザー |
![]() |
提出日時 | 2017-06-21 21:22:26 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 11 ms / 5,000 ms |
コード長 | 554 bytes |
コンパイル時間 | 335 ms |
コンパイル使用メモリ | 21,504 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-26 08:14:38 |
合計ジャッジ時間 | 978 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 22 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:11:1: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 11 | scanf("%d",&n); | ^~~~~~~~~~~~~~ main.c:15:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%d",&a[i]); | ^~~~~~~~~~~~~~~~~
ソースコード
#include <stdio.h> #include <string.h> int main(){ int n; int a[100001]; int i,j; int x=0; int temp1,temp2; int z[6]={0,0,0,0,0,0}; scanf("%d",&n); for(i=0;i<n;i++){ scanf("%d",&a[i]); } temp1=a[i]; for(j=0;j<n;j++){ for(i=0;i<6;i++){ if(a[j]==i+1){ z[i]++; } } } for(i=0;i<6;i++){ if(z[i]>temp1){ temp2=i; temp1=z[i]; } if(z[i]==temp1){ temp2=i; temp1=z[i]; //printf("!\n"); } } for(i=0;i<n;i++){ //printf("%d\n",z[i]); } printf("%d\n",temp2+1); return 0; }