結果
問題 | No.257 N言っちゃダメゲーム (3) |
ユーザー | crazybbb3 |
提出日時 | 2017-01-15 01:32:31 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 81 ms / 2,000 ms |
コード長 | 2,387 bytes |
コンパイル時間 | 3,301 ms |
コンパイル使用メモリ | 74,188 KB |
実行使用メモリ | 66,100 KB |
平均クエリ数 | 3.70 |
最終ジャッジ日時 | 2023-09-24 00:50:11 |
合計ジャッジ時間 | 7,192 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 80 ms
65,164 KB |
testcase_01 | AC | 81 ms
65,340 KB |
testcase_02 | AC | 77 ms
66,100 KB |
testcase_03 | AC | 76 ms
65,584 KB |
testcase_04 | AC | 77 ms
65,680 KB |
testcase_05 | AC | 74 ms
65,488 KB |
testcase_06 | AC | 76 ms
65,096 KB |
testcase_07 | AC | 76 ms
65,164 KB |
testcase_08 | AC | 76 ms
65,100 KB |
testcase_09 | AC | 77 ms
65,464 KB |
testcase_10 | AC | 76 ms
65,152 KB |
testcase_11 | AC | 75 ms
65,812 KB |
testcase_12 | AC | 76 ms
65,492 KB |
testcase_13 | AC | 76 ms
65,100 KB |
testcase_14 | AC | 81 ms
65,656 KB |
testcase_15 | AC | 77 ms
65,228 KB |
testcase_16 | AC | 76 ms
65,508 KB |
testcase_17 | AC | 75 ms
65,788 KB |
testcase_18 | AC | 75 ms
65,500 KB |
testcase_19 | AC | 76 ms
65,168 KB |
testcase_20 | AC | 78 ms
65,320 KB |
testcase_21 | AC | 76 ms
65,228 KB |
testcase_22 | AC | 75 ms
65,196 KB |
testcase_23 | AC | 76 ms
65,184 KB |
testcase_24 | AC | 76 ms
65,792 KB |
testcase_25 | AC | 76 ms
65,984 KB |
testcase_26 | AC | 75 ms
65,452 KB |
testcase_27 | AC | 78 ms
65,140 KB |
testcase_28 | AC | 77 ms
65,640 KB |
testcase_29 | AC | 80 ms
65,120 KB |
ソースコード
import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.util.*; public class Main { void solve() throws IOException { int n = ni(); int k = ni(); if ((n - 1) % (k + 1) == 0) { out.println(0); } else { out.println((n - 1) % (k + 1)); } out.flush(); while (true) { int b = ni(); if (b >= n) return; out.println(b + (n - 1 - b) % (k + 1)); out.flush(); } } String ns() throws IOException { while (!tok.hasMoreTokens()) { tok = new StringTokenizer(in.readLine(), " "); } return tok.nextToken(); } int ni() throws IOException { return Integer.parseInt(ns()); } long nl() throws IOException { return Long.parseLong(ns()); } double nd() throws IOException { return Double.parseDouble(ns()); } String[] nsa(int n) throws IOException { String[] res = new String[n]; for (int i = 0; i < n; i++) { res[i] = ns(); } return res; } int[] nia(int n) throws IOException { int[] res = new int[n]; for (int i = 0; i < n; i++) { res[i] = ni(); } return res; } long[] nla(int n) throws IOException { long[] res = new long[n]; for (int i = 0; i < n; i++) { res[i] = nl(); } return res; } class INA { int[][] a; INA(int n, int m) throws IOException { this(n, m, -1); } INA(int n, int m, int t) throws IOException { a = new int[m][n]; for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { a[j][i] = ni() + t; } } } int[] get(int i) { return a[i - 1]; } } static BufferedReader in; static PrintWriter out; static StringTokenizer tok; public static void main(String[] args) throws IOException { in = new BufferedReader(new InputStreamReader(System.in)); out = new PrintWriter(System.out); tok = new StringTokenizer(""); Main main = new Main(); main.solve(); out.close(); } }