結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー kurenai3110kurenai3110
提出日時 2016-12-06 16:30:56
言語 C++11
(gcc 13.3.0)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 381 bytes
コンパイル時間 710 ms
コンパイル使用メモリ 66,768 KB
実行使用メモリ 25,476 KB
平均クエリ数 3.70
最終ジャッジ日時 2024-07-17 00:40:12
合計ジャッジ時間 4,171 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <string>
#include <iomanip>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)

int main() {
    int n,k;cin>>n>>k;
    int d = (n-1)%(k+1);
    cout<<min(d,n-1)<<endl;
    int e;
    while(cin>>e){
        if(e>=n)break;
        cout<<min(d + ((e-d)/(k+1)+1)*(k+1),n-1)<<endl;
    }
    
    return 0;
}
0