結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー tsugutsugutsugutsugu
提出日時 2023-04-28 17:06:51
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 63 ms / 2,000 ms
コード長 533 bytes
コンパイル時間 3,178 ms
コンパイル使用メモリ 243,644 KB
実行使用メモリ 25,220 KB
平均クエリ数 3.70
最終ジャッジ日時 2024-04-28 20:59:35
合計ジャッジ時間 7,558 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
24,580 KB
testcase_01 AC 57 ms
25,220 KB
testcase_02 AC 56 ms
25,220 KB
testcase_03 AC 56 ms
24,836 KB
testcase_04 AC 57 ms
24,824 KB
testcase_05 AC 56 ms
25,172 KB
testcase_06 AC 57 ms
24,580 KB
testcase_07 AC 56 ms
24,836 KB
testcase_08 AC 57 ms
24,836 KB
testcase_09 AC 57 ms
24,836 KB
testcase_10 AC 58 ms
24,580 KB
testcase_11 AC 57 ms
24,580 KB
testcase_12 AC 58 ms
24,580 KB
testcase_13 AC 58 ms
25,220 KB
testcase_14 AC 58 ms
25,220 KB
testcase_15 AC 58 ms
25,220 KB
testcase_16 AC 58 ms
25,220 KB
testcase_17 AC 57 ms
24,836 KB
testcase_18 AC 58 ms
24,836 KB
testcase_19 AC 58 ms
25,220 KB
testcase_20 AC 58 ms
25,220 KB
testcase_21 AC 57 ms
25,220 KB
testcase_22 AC 57 ms
25,220 KB
testcase_23 AC 57 ms
25,220 KB
testcase_24 AC 57 ms
24,836 KB
testcase_25 AC 57 ms
24,580 KB
testcase_26 AC 58 ms
25,220 KB
testcase_27 AC 57 ms
25,220 KB
testcase_28 AC 59 ms
24,836 KB
testcase_29 AC 57 ms
24,580 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, k;
    cin >> n >> k;
    if ((n - 1) % (k + 1) == 0) {
        cout << 0 << endl;
    } else {
        cout << (n - 1) % (k + 1) << endl;
    }
    int pre = (n - 1) % (k + 1);
    while (true) {
        int ret;
        cin >> ret;
        if (ret >= n) {
            return 0;
        }
        int dif = ret - pre;
        cout << ret + (k + 1 - dif) << endl;
        pre = ret + (k + 1 - dif);
    }
}
0