結果
| 問題 |
No.24 数当てゲーム
|
| コンテスト | |
| ユーザー |
youjo_yamioti
|
| 提出日時 | 2018-11-30 15:10:39 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 5,000 ms |
| コード長 | 670 bytes |
| コンパイル時間 | 133 ms |
| コンパイル使用メモリ | 24,320 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-26 23:39:33 |
| 合計ジャッジ時間 | 654 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 10 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:15:17: warning: format ‘%s’ expects argument of type ‘char*’, but argument 2 has type ‘char (*)[4]’ [-Wformat=]
15 | scanf("%s",&R);
| ~^ ~~
| | |
| | char (*)[4]
| char*
main.cpp:11:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
11 | scanf("%d",&N);
| ~~~~~^~~~~~~~~
main.cpp:14:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
14 | scanf("%d %d %d %d",&A,&B,&C,&D);
| ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~
main.cpp:15:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
15 | scanf("%s",&R);
| ~~~~~^~~~~~~~~
ソースコード
#include<cstdio>
#include<string.h>
using namespace std;
int main(){
int N;
int A,B,C,D;
char R[4];
int array[10];
int i,j;
for(i=0;i<10;i++) array[i] = 1;
scanf("%d",&N);
for(i=0;i<N;i++){
scanf("%d %d %d %d",&A,&B,&C,&D);
scanf("%s",&R);
if(strcmp(R,"YES")==0){
for(j=0;j<10;j++){
if(j != A && j != B && j != C && j != D) array[j] = 0;
}
}else{
for(j=0;j<10;j++){
if(j == A || j == B || j == C || j == D) array[j] = 0;
}
}
}
for(i=0;i<10;i++){
if(array[i]==1) printf("%d\n",i);
}
return 0;
}
youjo_yamioti