結果

問題 No.24 数当てゲーム
ユーザー BantakoBantako
提出日時 2017-06-23 20:16:47
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 776 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 23,808 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-04-14 21:31:39
合計ジャッジ時間 934 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 AC 1 ms
6,944 KB
testcase_02 AC 0 ms
6,940 KB
testcase_03 AC 1 ms
6,940 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 0 ms
6,940 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 0 ms
6,940 KB
testcase_08 AC 1 ms
6,940 KB
testcase_09 AC 1 ms
6,944 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:3:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
    3 | main(){
      | ^~~~
main.cpp: In function ‘int main()’:
main.cpp:27:26: warning: zero-length gnu_printf format string [-Wformat-zero-length]
   27 |                 l:printf("");
      |                          ^~
main.cpp:7:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    7 |     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 %s",&A[0],&A[1],&A[2],&A[3],R);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include<stdio.h>
#include<string.h>
main(){
    int N;
    int A[4];
    char R[4];
    scanf("%d",&N);
    //候補 存在しない場合は0
    int c[10];
    for(int i = 0;i < 10;i++){
        c[i] = 1;
    }
    for(int i = 0;i < N;i++){
        scanf("%d %d %d %d %s",&A[0],&A[1],&A[2],&A[3],R);
        if(!strcmp(R,"NO")){
            for(int j = 0;j < 4;j++){
                c[A[j]] = 0;
            }
        }else{
            for(int j = 0;j < 10;j++){
                for(int k = 0;k < 4;k++){
                    if(A[k] == j){
                        goto l;
                    }
                }
                c[j] = 0;
                l:printf("");
            }
        }
    }
    for(int i = 0;i < 10;i++){
        if(c[i]){printf("%d\n",i);}
    }
}
0