結果
| 問題 |
No.257 N言っちゃダメゲーム (3)
|
| コンテスト | |
| ユーザー |
machy
|
| 提出日時 | 2015-07-31 22:31:38 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 61 ms / 2,000 ms |
| コード長 | 472 bytes |
| コンパイル時間 | 474 ms |
| コンパイル使用メモリ | 57,852 KB |
| 実行使用メモリ | 25,476 KB |
| 平均クエリ数 | 3.70 |
| 最終ジャッジ日時 | 2024-07-16 20:53:02 |
| 合計ジャッジ時間 | 3,973 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 30 |
ソースコード
#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
int n, k;
cin >> n >> k;
int r = 0;
if((n - 1) % (k+1) == 0){
cout << "0" << endl;
cout.flush();
}else{
r = (n-1) % (k+1);
cout << r << endl;
}
while(true){
int v;
cin >> v;
if(v >= n) break;
cout << (v - r + k) / (k+1) * (k+1) + r << endl;
cout.flush();
}
return 0;
}
machy