結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー GrenacheGrenache
提出日時 2015-07-31 22:51:51
言語 Java19
(openjdk 21)
結果
AC  
実行時間 98 ms / 2,000 ms
コード長 1,913 bytes
コンパイル時間 3,760 ms
コンパイル使用メモリ 75,164 KB
実行使用メモリ 66,496 KB
平均クエリ数 3.70
最終ジャッジ日時 2023-09-23 21:06:17
合計ジャッジ時間 8,628 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
63,996 KB
testcase_01 AC 95 ms
65,888 KB
testcase_02 AC 94 ms
65,360 KB
testcase_03 AC 94 ms
65,324 KB
testcase_04 AC 94 ms
66,368 KB
testcase_05 AC 95 ms
65,480 KB
testcase_06 AC 95 ms
63,932 KB
testcase_07 AC 96 ms
65,272 KB
testcase_08 AC 96 ms
65,516 KB
testcase_09 AC 95 ms
66,384 KB
testcase_10 AC 96 ms
63,524 KB
testcase_11 AC 94 ms
65,864 KB
testcase_12 AC 95 ms
66,140 KB
testcase_13 AC 98 ms
65,464 KB
testcase_14 AC 96 ms
66,076 KB
testcase_15 AC 96 ms
65,984 KB
testcase_16 AC 95 ms
65,964 KB
testcase_17 AC 94 ms
65,544 KB
testcase_18 AC 94 ms
65,388 KB
testcase_19 AC 97 ms
65,096 KB
testcase_20 AC 96 ms
66,488 KB
testcase_21 AC 96 ms
65,540 KB
testcase_22 AC 93 ms
65,456 KB
testcase_23 AC 93 ms
63,396 KB
testcase_24 AC 93 ms
65,396 KB
testcase_25 AC 93 ms
65,752 KB
testcase_26 AC 95 ms
65,644 KB
testcase_27 AC 95 ms
63,664 KB
testcase_28 AC 95 ms
66,496 KB
testcase_29 AC 94 ms
66,084 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.Iterator;


public class Main_yukicoder257 {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Printer pr = new Printer(System.out);

        int n = sc.nextInt();
        int k = sc.nextInt();

        if (n % (k + 1) == 1) {
        	pr.println("0");
        	pr.flush();
        } else {
        	int b = 0;
        	int a = (n - 1 - b) % (k + 1) + b;
        	pr.println(a);
        	pr.flush();
        }

        int b;
        while ((b = sc.nextInt()) < n) {
        	int a = (n - 1 - b) % (k + 1) + b;
        	pr.println(a);
        	pr.flush();
        }

    	pr.close();
        sc.close();
    }

	@SuppressWarnings("unused")
	private static class Scanner {
		BufferedReader br;
		Iterator<String> it;
		
		Scanner (InputStream in) {
			br = new BufferedReader(new InputStreamReader(in));
		}
		
		String next() throws RuntimeException  {
			try {
				if (it == null || !it.hasNext()) {
					it = Arrays.asList(br.readLine().split(" ")).iterator();
				}
				return it.next();
			} catch (IOException e) {
				throw new IllegalStateException();
			}
		}
		
		int nextInt() throws RuntimeException {
			return Integer.parseInt(next());
		}

		long nextLong() throws RuntimeException {
			return Long.parseLong(next());
		}

		float nextFloat() throws RuntimeException {
			return Float.parseFloat(next());
		}

		double nextDouble() throws RuntimeException {
			return Double.parseDouble(next());
		}

		void close() {
			try {
				br.close();
			} catch (IOException e) {
//				throw new IllegalStateException();
			}
		}
	}

	private static class Printer extends PrintWriter {
		Printer(PrintStream out) {
			super(out);
		}
	}
}
0