結果
| 問題 | No.24 数当てゲーム | 
| コンテスト | |
| ユーザー |  youjo_yamioti | 
| 提出日時 | 2018-11-30 15:09:21 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 670 bytes | 
| コンパイル時間 | 192 ms | 
| コンパイル使用メモリ | 24,192 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-26 23:39:32 | 
| 合計ジャッジ時間 | 967 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 8 WA * 2 | 
コンパイルメッセージ
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=1;j<10;j++){
                if(j != A && j != B && j != C && j != D) array[j] = 0;
            }
        }else{
            for(j=1;j<10;j++){
                if(j == A || j == B || j == C || j == D) array[j] = 0;
            }
        }
    }
    for(i=1;i<10;i++){
        if(array[i]==1) printf("%d\n",i);
    }
    return 0;
}
            
            
            
        