結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー tsugutsugu
提出日時 2023-04-28 17:03:23
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 467 bytes
コンパイル時間 3,109 ms
コンパイル使用メモリ 242,064 KB
実行使用メモリ 25,604 KB
平均クエリ数 6.80
最終ジャッジ日時 2024-11-17 16:44:12
合計ジャッジ時間 7,002 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 7 WA * 23
権限があれば一括ダウンロードができます

ソースコード

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;
    }
    while (true) {
        int ret;
        cin >> ret;
        if (ret >= n) {
            return 0;
        }
        int md = ret % (k + 1);
        cout << ret + (k + 1 - md) << endl;
    }
}
0