結果

問題 No.355 数当てゲーム(2)
ユーザー 37zigen37zigen
提出日時 2016-04-02 13:40:58
言語 Java21
(openjdk 21)
結果
AC  
実行時間 191 ms / 2,000 ms
コード長 1,209 bytes
コンパイル時間 2,389 ms
コンパイル使用メモリ 78,232 KB
実行使用メモリ 75,240 KB
平均クエリ数 27.13
最終ジャッジ日時 2023-09-23 23:35:11
合計ジャッジ時間 13,490 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 172 ms
73,356 KB
testcase_01 AC 191 ms
72,592 KB
testcase_02 AC 178 ms
72,488 KB
testcase_03 AC 175 ms
72,868 KB
testcase_04 AC 171 ms
72,472 KB
testcase_05 AC 167 ms
72,772 KB
testcase_06 AC 185 ms
72,552 KB
testcase_07 AC 179 ms
72,840 KB
testcase_08 AC 180 ms
72,836 KB
testcase_09 AC 180 ms
72,856 KB
testcase_10 AC 168 ms
72,416 KB
testcase_11 AC 180 ms
72,820 KB
testcase_12 AC 183 ms
73,120 KB
testcase_13 AC 183 ms
73,332 KB
testcase_14 AC 167 ms
72,612 KB
testcase_15 AC 177 ms
72,504 KB
testcase_16 AC 183 ms
72,772 KB
testcase_17 AC 165 ms
72,656 KB
testcase_18 AC 161 ms
72,864 KB
testcase_19 AC 172 ms
72,828 KB
testcase_20 AC 172 ms
72,548 KB
testcase_21 AC 173 ms
72,700 KB
testcase_22 AC 165 ms
72,920 KB
testcase_23 AC 180 ms
72,752 KB
testcase_24 AC 181 ms
73,128 KB
testcase_25 AC 177 ms
72,820 KB
testcase_26 AC 169 ms
72,668 KB
testcase_27 AC 167 ms
73,072 KB
testcase_28 AC 167 ms
73,380 KB
testcase_29 AC 176 ms
72,944 KB
testcase_30 AC 162 ms
72,932 KB
testcase_31 AC 172 ms
72,584 KB
testcase_32 AC 172 ms
72,972 KB
testcase_33 AC 187 ms
72,548 KB
testcase_34 AC 167 ms
72,640 KB
testcase_35 AC 159 ms
72,856 KB
testcase_36 AC 174 ms
72,952 KB
testcase_37 AC 176 ms
73,072 KB
testcase_38 AC 173 ms
72,560 KB
testcase_39 AC 167 ms
73,060 KB
testcase_40 AC 181 ms
72,300 KB
testcase_41 AC 173 ms
72,464 KB
testcase_42 AC 182 ms
73,240 KB
testcase_43 AC 179 ms
72,968 KB
testcase_44 AC 183 ms
74,700 KB
testcase_45 AC 161 ms
72,396 KB
testcase_46 AC 171 ms
72,772 KB
testcase_47 AC 170 ms
73,100 KB
testcase_48 AC 172 ms
73,112 KB
testcase_49 AC 184 ms
75,240 KB
testcase_50 AC 169 ms
73,240 KB
testcase_51 AC 159 ms
72,664 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package yukicoder355;
import java.util.Scanner;
public class Main {
	public static void main(String[] args){
		Scanner sc=new Scanner(System.in);
		int[] d={0,1,2,3};
		for(int i=0;i<4;i++){;
		boolean flag=false;
		int memo=0;
		int flagValue=-1;
			for(int j=0;j<10;j++){
				d[i]=j;
				boolean f=true;
				//重複する数字がある組み合わせを除去
				for(int k=0;k<4;k++){
					if(d[i]==d[k]&&i!=k)f=false;
				}
				if(!f)continue;
				System.out.println(d[0]+" "+d[1]+" "+d[2]+" "+d[3]);
				int aa=sc.nextInt();
				int bb=sc.nextInt();
				if(aa==4&bb==0){
					return;
				}else if(!flag){
					memo=aa+bb;
					flagValue=j;
					flag=true;
				}else if(flag){
					if(memo<aa+bb){
						break;
					}else if(memo==aa+bb){
						continue;
					}else if(memo>aa+bb){
						d[i]=flagValue;
						break;
					}
				}
			}
			
			
		}

		for(int i=0;i<4;i++){
			for(int j=0;j<4;j++){
				if(i==j)continue;
				for(int k=0;k<4;k++){
					if(i==k||j==k)continue;
					for(int l=0;l<4;l++){
						if(i==l||j==l||k==l)continue;
						System.out.println(d[i]+" "+d[j]+" "+d[k]+" "+d[l]);
						int a=sc.nextInt();
						int b=sc.nextInt();
						if(a==4&&b==0)return;
					}
				}
			}
		}
	}
}
0