結果
| 問題 | No.257 N言っちゃダメゲーム (3) |
| コンテスト | |
| ユーザー |
wahr69
|
| 提出日時 | 2015-07-31 23:49:23 |
| 言語 | C++11 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
不安定
|
| 実行時間 | 72 ms / 2,000 ms |
| + 1µs | |
| コード長 | 629 bytes |
| 記録 | |
| コンパイル時間 | 289 ms |
| コンパイル使用メモリ | 78,204 KB |
| 実行使用メモリ | 7,464 KB |
| 平均クエリ数 | 3.70 |
| 最終ジャッジ日時 | 2026-08-14 15:35:24 |
| 合計ジャッジ時間 | 3,103 ms |
|
ジャッジサーバーID (参考情報) |
judge3_0 / judge2_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
int N, K;
cin >> N >> K;
if (N == 1) {
cout << "0" << endl;
cout.flush();
int op;
cin >> op;
return 0;
}
int turn = 0;
bool ato = (N % (K + 1) == 1);
if (ato) {
cout << "0" << endl;
cout.flush();
} else {
int winNum = (K + 1) * turn + ((N - 1) % (K + 1));
cout << winNum << endl;
cout.flush();
}
while (true) {
int op;
cin >> op;
++turn;
if (op >= N) {
return 0;
}
int winNum = (K + 1) * turn + ((N - 1) % (K + 1));
cout << winNum << endl;
cout.flush();
}
}
wahr69