結果

問題 No.355 数当てゲーム(2)
ユーザー kongarishisyamokongarishisyamo
提出日時 2016-04-01 23:19:41
言語 C++11
(gcc 11.4.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,039 bytes
コンパイル時間 407 ms
コンパイル使用メモリ 53,732 KB
実行使用メモリ 37,856 KB
平均クエリ数 4.50
最終ジャッジ日時 2023-09-23 23:26:49
合計ジャッジ時間 4,317 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 28 ms
24,048 KB
testcase_01 AC 25 ms
24,336 KB
testcase_02 AC 24 ms
23,640 KB
testcase_03 AC 27 ms
23,808 KB
testcase_04 AC 26 ms
24,348 KB
testcase_05 TLE -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<cstdlib>
#include<ctime>

using namespace std;

int main(){

	int X,Y;
	int N1,N2,N3,N4;
	int flag[10]={0};

	srand((unsigned)time(NULL));

	while(1){
		while(1){
			N1=rand()%10;
			N2=rand()%10;
			N3=rand()%10;
			N4=rand()%10;
			if(N1!=N2&&N1!=N3&&N1!=N4&&N2!=N3&&N2!=N4&&N3!=N4) break;
		}
		cout<<N1<<" "<<N2<<" "<<N3<<" "<<N4<<endl<<flush;
		cin>>X>>Y;
		if(X==0&&Y==0) break;
	}

	flag[N1]=1;
	flag[N2]=1;
	flag[N3]=1;
	flag[N4]=1;

	while(1){
		while(1){
			N3=rand()%10;
			N4=rand()%10;
			if(N1!=N2&&N1!=N3&&N1!=N4&&N2!=N3&&N2!=N4&&N3!=N4&&flag[N3]==0&&flag[N4]==0) break;
		}
		cout<<N1<<" "<<N2<<" "<<N3<<" "<<N4<<endl<<flush;
		cin>>X>>Y;
		if(X==0&&Y==0) break;
	}
	flag[N3]=1;
	flag[N4]=1;

	for(int i=0;;i++){
		N1=i/1000%10;
		N2=i/100%10;
		N3=i/10%10;
		N4=i/1%10;
		if(N1!=N2&&N1!=N3&&N1!=N4&&N2!=N3&&N2!=N4&&N3!=N4){
			if(flag[N1]==0&&flag[N2]==0&&flag[N3]==0&&flag[N4]==0){
				cout<<N1<<" "<<N2<<" "<<N3<<" "<<N4<<endl<<flush;
				cin>>X>>Y;
				if(X==4&&Y==0) break;
			}
		}
	}

}

0