結果
| 問題 | No.24 数当てゲーム |
| コンテスト | |
| ユーザー |
Yang33
|
| 提出日時 | 2016-01-02 23:49:25 |
| 言語 | C90 (gcc 12.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 636 bytes |
| コンパイル時間 | 880 ms |
| コンパイル使用メモリ | 21,376 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-19 10:39:23 |
| 合計ジャッジ時間 | 1,311 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
コンパイルメッセージ
main.c: In function ‘main’:
main.c:7:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
7 | scanf("%d", &n);
| ^~~~~~~~~~~~~~~
main.c:11:25: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d", &que[p]);//数字4つ
| ^~~~~~~~~~~~~~~~~~~~
main.c:12:17: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
12 | scanf("%s", s);//9-12はkにおける読み込み
| ^~~~~~~~~~~~~~
ソースコード
#include<stdio.h>
#include<string.h>
int main(void) {
int n, ans[11] = { 1,1,1,1,1,1,1,1,1,1,-10 }, que[5], i, j, k, p, check = 1;
char s[3];
scanf("%d", &n);
for (k = 0; k < n; k++) {
for (p = 1; p <= 4; p++)
scanf("%d", &que[p]);//数字4つ
scanf("%s", s);//9-12はkにおける読み込み
if (s[0] == 'N') {
for (i = 1; i <= 4; i++) {
ans[que[i]] = 0;//NOは0
}
}
else {//YES
check += 1;
for (i = 1; i <= 4; i++)
ans[que[i]] += 1;
}
}
for (i = 0; i < 11; i++) {
if (ans[i] == check) {
printf("%d", i);
break;
}
if (i == 10) {
check--;
i = 0;
}
}
return 0;
}
Yang33