結果

問題 No.355 数当てゲーム(2)
ユーザー kongarishisyamokongarishisyamo
提出日時 2016-06-09 10:54:47
言語 C++11
(gcc 11.4.0)
結果
RE  
(最新)
AC  
(最初)
実行時間 -
コード長 960 bytes
コンパイル時間 648 ms
コンパイル使用メモリ 52,808 KB
実行使用メモリ 24,312 KB
平均クエリ数 26.73
最終ジャッジ日時 2023-09-23 10:53:00
合計ジャッジ時間 5,811 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
24,168 KB
testcase_01 AC 39 ms
23,940 KB
testcase_02 AC 53 ms
23,880 KB
testcase_03 AC 27 ms
24,204 KB
testcase_04 AC 27 ms
24,240 KB
testcase_05 AC 26 ms
23,460 KB
testcase_06 AC 27 ms
23,496 KB
testcase_07 AC 104 ms
24,192 KB
testcase_08 AC 26 ms
23,964 KB
testcase_09 AC 27 ms
24,252 KB
testcase_10 AC 25 ms
23,244 KB
testcase_11 AC 27 ms
23,244 KB
testcase_12 AC 30 ms
23,880 KB
testcase_13 AC 27 ms
23,064 KB
testcase_14 AC 30 ms
23,556 KB
testcase_15 AC 37 ms
24,180 KB
testcase_16 AC 26 ms
23,952 KB
testcase_17 AC 31 ms
23,988 KB
testcase_18 AC 26 ms
24,240 KB
testcase_19 AC 26 ms
24,252 KB
testcase_20 AC 26 ms
23,364 KB
testcase_21 AC 34 ms
23,340 KB
testcase_22 AC 30 ms
23,976 KB
testcase_23 AC 26 ms
23,472 KB
testcase_24 AC 49 ms
24,216 KB
testcase_25 AC 28 ms
23,580 KB
testcase_26 AC 41 ms
23,244 KB
testcase_27 AC 26 ms
23,664 KB
testcase_28 AC 26 ms
24,144 KB
testcase_29 AC 29 ms
23,484 KB
testcase_30 AC 34 ms
23,460 KB
testcase_31 AC 41 ms
23,352 KB
testcase_32 AC 25 ms
24,168 KB
testcase_33 RE -
testcase_34 AC 45 ms
23,304 KB
testcase_35 AC 28 ms
23,580 KB
testcase_36 AC 26 ms
23,880 KB
testcase_37 AC 29 ms
24,180 KB
testcase_38 AC 27 ms
23,868 KB
testcase_39 AC 39 ms
23,364 KB
testcase_40 AC 27 ms
24,240 KB
testcase_41 AC 37 ms
23,676 KB
testcase_42 AC 27 ms
23,448 KB
testcase_43 AC 38 ms
24,192 KB
testcase_44 AC 28 ms
23,484 KB
testcase_45 AC 29 ms
23,964 KB
testcase_46 AC 32 ms
23,460 KB
testcase_47 AC 28 ms
23,460 KB
testcase_48 AC 26 ms
23,940 KB
testcase_49 AC 33 ms
24,084 KB
testcase_50 AC 29 ms
24,312 KB
testcase_51 AC 64 ms
23,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdlib>

using namespace std;

typedef struct{
  int X,Y;
  int N[4];
} memo;

int main(){

  int N[4];
  memo Nmemo[100];
  int t=0;
  int X,Y;

  srand('S'+'H'+'I'+'S'+'Y'+'A'+'M'+'O');

  while(1){

    for(int i=0;i<4;i++) N[i]=rand()%10;

    bool f=true;

    for(int i=0;i<4;i++){
      for(int j=0;j<4;j++){
	if(i!=j&&N[i]==N[j]) f=false;
      }
    }

    for(int i=0;i<t;i++){
      int tmpX=0,tmpY=0;
      for(int j=0;j<4;j++){
	for(int k=0;k<4;k++){
	  if(j==k&&N[j]==Nmemo[i].N[k]) tmpX++;
	  else if(j!=k&&N[j]==Nmemo[i].N[k]) tmpY++;
	}
      }
      if(Nmemo[i].X>tmpX) f=false;
      else if(Nmemo[i].X==tmpX&&Nmemo[i].Y>tmpY) f=false;
    }

    if(!f) continue;

    cout<<N[0]<<" "<<N[1]<<" "<<N[2]<<" "<<N[3]<<endl<<flush;
    cin>>X>>Y;

    if(X==4) break;

    Nmemo[t].X=X;
    Nmemo[t].Y=Y;
    Nmemo[t].N[0]=N[0];
    Nmemo[t].N[1]=N[1];
    Nmemo[t].N[2]=N[2];
    Nmemo[t].N[3]=N[3];
    t++;
  }
}

0