結果
問題 | No.24 数当てゲーム |
ユーザー |
![]() |
提出日時 | 2016-02-27 00:24:29 |
言語 | C90 (gcc 12.3.0) |
結果 |
AC
|
実行時間 | 1 ms / 5,000 ms |
コード長 | 568 bytes |
コンパイル時間 | 294 ms |
コンパイル使用メモリ | 21,504 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-24 10:44:38 |
合計ジャッジ時間 | 719 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 10 |
コンパイルメッセージ
main.c: In function ‘main’: main.c:13:3: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 13 | scanf("%d",&N); | ^~~~~~~~~~~~~~ main.c:15:5: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result] 15 | scanf("%d %d %d %d %s",&a[i][0],&a[i][1],&a[i][2],&a[i][3],r[i]); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ソースコード
#include<stdio.h>#include<string.h>int main(){int N;int a[6][4];char r[6][4];int i,j;int max = 0;int flag[10]={0};scanf("%d",&N);for(i=0;i<N;i++){scanf("%d %d %d %d %s",&a[i][0],&a[i][1],&a[i][2],&a[i][3],r[i]);}for(i=0;i<N;i++){if(strcmp(r[i],"YES")==0){for(j=0;j<4;j++){flag[a[i][j]] += 1;}}else{for(j=0;j<4;j++){flag[a[i][j]] -= 1;}}}for(i=0;i<10;i++){if(max<=flag[i]){max = flag[i];j = i;}}printf("%d\n",j);return 0;}