結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー ぴろず
提出日時 2015-07-31 22:41:59
言語 Java
(openjdk 23)
結果
RE  
実行時間 -
コード長 433 bytes
コンパイル時間 2,253 ms
コンパイル使用メモリ 73,676 KB
実行使用メモリ 70,936 KB
平均クエリ数 3.77
最終ジャッジ日時 2024-07-16 05:17:40
合計ジャッジ時間 9,204 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 28 RE * 2
権限があれば一括ダウンロードができます

ソースコード

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();
		}
		while(true) {
			System.out.println(n - 1 - (n - 1 - x) / (k + 1) * (k + 1));
			x = sc.nextInt();
			if (x >= n) {
				break;
			}
		}
	}

}
0