結果
問題 |
No.257 N言っちゃダメゲーム (3)
|
ユーザー |
![]() |
提出日時 | 2021-05-05 13:51:40 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 85 ms / 2,000 ms |
コード長 | 604 bytes |
コンパイル時間 | 1,998 ms |
コンパイル使用メモリ | 192,732 KB |
最終ジャッジ日時 | 2025-01-21 07:21:24 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 30 |
ソースコード
//https://ncode.syosetu.com/n4830bu/257/ #include <bits/stdc++.h> using namespace std; int main() { int N, K; cin >> N >> K; if ((N - 1) % (K + 1) == 0) { //後攻 cout << 0 << endl; int x; while (cin >> x) { if (x >= N) return 0; cout << (x + K) / (K + 1) * (K + 1) << endl; } } else { //先攻 for (int i = 0;; i++) { cout << i * (K + 1) + (N - 1) % (K + 1) << endl; int x; cin >> x; if (x >= N) return 0; } } }