結果
| 問題 |
No.257 N言っちゃダメゲーム (3)
|
| コンテスト | |
| ユーザー |
tetsuzuki1115
|
| 提出日時 | 2019-08-16 06:11:11 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 66 ms / 2,000 ms |
| コード長 | 872 bytes |
| コンパイル時間 | 801 ms |
| コンパイル使用メモリ | 83,048 KB |
| 実行使用メモリ | 25,476 KB |
| 平均クエリ数 | 3.70 |
| 最終ジャッジ日時 | 2024-07-17 02:21:03 |
| 合計ジャッジ時間 | 4,538 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
ソースコード
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <math.h>
#include <cmath>
#include <limits.h>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <functional>
#include <stdio.h>
using namespace std;
long long MOD = 1000000007;
int main() {
long long N,K;
cin >> N >> K;
bool turn = (N-1)%(K+1) > 0;
if ( (N-1)%(K+1) == 0 ) { cout << 0 << endl << flush; }
long long a = 0;
long long diff = 0;
long long temp;
while ( true ) {
if ( turn ) {
if ( a == 0 ) { a = (N-1)%(K+1); }
else { a += ( K+1 )-diff; }
cout << a << endl << flush;
}
else {
cin >> temp;
if ( temp >= N ) { return 0; }
diff = temp - a;
a = temp;
}
turn = !turn;
}
return 0;
}
tetsuzuki1115