結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー ldsyb
提出日時 2016-03-16 17:08:20
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 519 bytes
コンパイル時間 424 ms
コンパイル使用メモリ 55,960 KB
実行使用メモリ 43,812 KB
平均クエリ数 0.20
最終ジャッジ日時 2024-07-16 23:05:48
合計ジャッジ時間 4,169 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 1 TLE * 1 -- * 28
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
using namespace std;

int main(){
   int i,o,n,k;
   cin >> n >> k;
   if((n - 1) % (k + 1) == 0){
      cout << 0 << endl;
      cin >> i;
      o = k + 1;
      while(o < n){
         cout << o << endl;
         o += k + 1;
         cin >> i;
         if(i > n) return 0;
      }
   }else{
      if((n - 1) % (k + 1) != -1) o = (n - 1) % (k + 1);
      else o = k;
      while(o < n){
         cout << n << endl;
         n += k + 1;
         cin >> i;
         if(i > n) return 0;
      }
   }
}
0