結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー ぴろずぴろず
提出日時 2015-07-31 22:43:39
言語 Java21
(openjdk 21)
結果
AC  
実行時間 173 ms / 2,000 ms
コード長 467 bytes
コンパイル時間 2,062 ms
コンパイル使用メモリ 71,336 KB
実行使用メモリ 72,496 KB
平均クエリ数 3.70
最終ジャッジ日時 2023-09-23 21:05:33
合計ジャッジ時間 9,435 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 173 ms
71,916 KB
testcase_01 AC 166 ms
71,380 KB
testcase_02 AC 165 ms
71,744 KB
testcase_03 AC 165 ms
72,028 KB
testcase_04 AC 166 ms
71,604 KB
testcase_05 AC 166 ms
71,468 KB
testcase_06 AC 166 ms
72,028 KB
testcase_07 AC 166 ms
71,872 KB
testcase_08 AC 169 ms
71,812 KB
testcase_09 AC 168 ms
71,812 KB
testcase_10 AC 166 ms
71,832 KB
testcase_11 AC 164 ms
71,416 KB
testcase_12 AC 165 ms
72,000 KB
testcase_13 AC 164 ms
72,496 KB
testcase_14 AC 165 ms
72,088 KB
testcase_15 AC 167 ms
71,436 KB
testcase_16 AC 171 ms
71,988 KB
testcase_17 AC 170 ms
72,144 KB
testcase_18 AC 173 ms
71,496 KB
testcase_19 AC 170 ms
71,728 KB
testcase_20 AC 173 ms
71,876 KB
testcase_21 AC 169 ms
72,364 KB
testcase_22 AC 170 ms
71,916 KB
testcase_23 AC 168 ms
71,676 KB
testcase_24 AC 168 ms
71,672 KB
testcase_25 AC 168 ms
71,852 KB
testcase_26 AC 171 ms
72,236 KB
testcase_27 AC 171 ms
72,024 KB
testcase_28 AC 171 ms
71,524 KB
testcase_29 AC 171 ms
71,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

package no257;

import java.util.Scanner;

public class Main {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int x = 0;
		int k = sc.nextInt();
		if ((n - 1) % (k + 1) == 0) {
			System.out.println(0);
			x = sc.nextInt();
			if (x >= n) {
				return;
			}
		}
		while(true) {
			System.out.println(n - 1 - (n - 1 - x) / (k + 1) * (k + 1));
			x = sc.nextInt();
			if (x >= n) {
				break;
			}
		}
	}

}
0