結果

問題 No.257 N言っちゃダメゲーム (3)
ユーザー kpinkcat
提出日時 2023-12-08 19:25:13
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 399 ms / 2,000 ms
コード長 638 bytes
コンパイル時間 891 ms
コンパイル使用メモリ 102,152 KB
最終ジャッジ日時 2025-02-18 09:31:29
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<list>
#include<queue>
#include<math.h>
#include<bitset>
using ll = long long;
using namespace std;

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