結果
問題 | No.257 N言っちゃダメゲーム (3) |
ユーザー |
|
提出日時 | 2023-04-28 17:06:51 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 58 ms / 2,000 ms |
コード長 | 533 bytes |
コンパイル時間 | 2,900 ms |
コンパイル使用メモリ | 242,840 KB |
実行使用メモリ | 25,476 KB |
平均クエリ数 | 3.70 |
最終ジャッジ日時 | 2024-11-17 16:47:36 |
合計ジャッジ時間 | 6,635 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
#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); } }