結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー nCk_cvnCk_cv
提出日時 2015-08-01 14:58:01
言語 Java21
(openjdk 21)
結果
AC  
実行時間 165 ms / 2,000 ms
コード長 473 bytes
コンパイル時間 2,140 ms
コンパイル使用メモリ 71,948 KB
実行使用メモリ 72,760 KB
平均クエリ数 3.70
最終ジャッジ日時 2023-09-23 21:13:35
合計ジャッジ時間 9,524 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 164 ms
71,344 KB
testcase_01 AC 152 ms
71,632 KB
testcase_02 AC 159 ms
69,812 KB
testcase_03 AC 159 ms
72,180 KB
testcase_04 AC 160 ms
71,824 KB
testcase_05 AC 160 ms
72,256 KB
testcase_06 AC 163 ms
71,308 KB
testcase_07 AC 165 ms
71,892 KB
testcase_08 AC 154 ms
71,860 KB
testcase_09 AC 155 ms
71,348 KB
testcase_10 AC 157 ms
72,444 KB
testcase_11 AC 163 ms
71,952 KB
testcase_12 AC 161 ms
72,532 KB
testcase_13 AC 157 ms
72,060 KB
testcase_14 AC 154 ms
69,140 KB
testcase_15 AC 159 ms
72,416 KB
testcase_16 AC 158 ms
71,464 KB
testcase_17 AC 158 ms
72,092 KB
testcase_18 AC 153 ms
71,508 KB
testcase_19 AC 158 ms
70,296 KB
testcase_20 AC 159 ms
71,724 KB
testcase_21 AC 160 ms
72,760 KB
testcase_22 AC 158 ms
72,164 KB
testcase_23 AC 160 ms
71,956 KB
testcase_24 AC 159 ms
71,912 KB
testcase_25 AC 153 ms
72,356 KB
testcase_26 AC 158 ms
69,612 KB
testcase_27 AC 160 ms
72,600 KB
testcase_28 AC 161 ms
72,036 KB
testcase_29 AC 158 ms
72,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.*;

class Main {
	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int k = sc.nextInt();
		ArrayList<Integer> list = new ArrayList<Integer>();
		for(int i = n-1; i >= 0; i -= k+1) {
			list.add(i);
		}
		
		for(int i = list.size()-1; i >= 0; i--) {
			System.out.println(list.get(i));
			int in = sc.nextInt();
			if(in >= n) break;
			if(i > 0 && list.get(i-1) == in) {
				i--;
			}
		}
		
		
	}
}
0