結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー YamaKasa
提出日時 2018-09-07 21:16:28
言語 Java
(openjdk 23)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 685 bytes
コンパイル時間 2,253 ms
コンパイル使用メモリ 74,172 KB
実行使用メモリ 58,336 KB
平均クエリ数 7.57
最終ジャッジ日時 2024-07-16 16:06:03
合計ジャッジ時間 10,926 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 4 WA * 26
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.util.Scanner;

public class Main {
	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		int N = scan.nextInt();
		int K = scan.nextInt();
		if(N <= K) {
			System.out.println(N - 1);
		}else {
			if((N - 1) % (K + 1) == 0) {
				System.out.println(0);
				int t = scan.nextInt();
				while(t <= N - 1) {
					int a = t % K;
					a = K - a;
					System.out.println(t + a);
					t = scan.nextInt();
				}
				scan.close();
			}else {
				System.out.println(K);
				int t = scan.nextInt();
				while(t <= N - 1) {
					int a = t % K;
					a = K - a;
					System.out.println(t + a);
					t = scan.nextInt();
				}
				scan.close();
			}
		}
	}
}
0