結果
| 問題 | No.24 数当てゲーム | 
| コンテスト | |
| ユーザー |  Elk | 
| 提出日時 | 2018-05-28 23:27:54 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                WA
                                 
                             | 
| 実行時間 | - | 
| コード長 | 842 bytes | 
| コンパイル時間 | 211 ms | 
| コンパイル使用メモリ | 24,192 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-06-30 07:53:57 | 
| 合計ジャッジ時間 | 846 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 8 WA * 2 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:9:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    9 |     scanf("%d\n", &N);
      |     ~~~~~^~~~~~~~~~~~
main.cpp:11:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |         scanf("%d %d %d %d %s\n", &num[i][0], &num[i][1], &num[i][2], &num[i][3], str[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
            
            ソースコード
#include <stdio.h>
#include <string.h>
int main(){
    int N, i, j, cnt_y = 0, cnt_n = 0, num[6][4];
    char str[6][4];
    int YES[11] = {0}, NO[11] = {0};
    scanf("%d\n", &N);
    for(i = 0; i < N; i++){
        scanf("%d %d %d %d %s\n", &num[i][0], &num[i][1], &num[i][2], &num[i][3], str[i]);
    }
    for(i = 0; i < N; i++){
        for(j = 0; j < 4; j++){
            if(strcmp(str[i], "YES") == 0){
                YES[num[i][j]]++;
            }else if(strcmp(str[i], "NO") == 0){
                NO[num[i][j]]++;
            }
        }
        if(strcmp(str[i], "YES") == 0)  cnt_y++;
        if(strcmp(str[i], "NO") == 0)  cnt_n++;
    }
    //printf("cnt_y %d cnt_no %d\n", cnt_y, cnt_n);
    for(i = 1; i <= 9; i++){
        if(YES[i] == cnt_y && NO[i] == 0){
            printf("%d\n", i);
        }
    }
    return 0;
}
            
            
            
        