結果

問題 No.1651 Removing Cards
ユーザー chocoruskchocorusk
提出日時 2021-06-20 18:21:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 197 ms / 2,000 ms
コード長 718 bytes
コンパイル時間 6,782 ms
コンパイル使用メモリ 243,760 KB
実行使用メモリ 18,440 KB
最終ジャッジ日時 2024-04-22 03:23:17
合計ジャッジ時間 13,895 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 AC 1 ms
5,248 KB
testcase_02 AC 5 ms
5,376 KB
testcase_03 AC 3 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 181 ms
12,260 KB
testcase_10 AC 184 ms
12,396 KB
testcase_11 AC 179 ms
12,388 KB
testcase_12 AC 182 ms
12,388 KB
testcase_13 AC 170 ms
12,260 KB
testcase_14 AC 164 ms
12,388 KB
testcase_15 AC 188 ms
16,632 KB
testcase_16 AC 185 ms
16,760 KB
testcase_17 AC 185 ms
16,764 KB
testcase_18 AC 186 ms
16,628 KB
testcase_19 AC 188 ms
16,760 KB
testcase_20 AC 186 ms
16,636 KB
testcase_21 AC 188 ms
16,632 KB
testcase_22 AC 171 ms
18,440 KB
testcase_23 AC 168 ms
12,080 KB
testcase_24 AC 140 ms
8,332 KB
testcase_25 AC 160 ms
12,560 KB
testcase_26 AC 165 ms
12,432 KB
testcase_27 AC 197 ms
17,716 KB
testcase_28 AC 193 ms
17,712 KB
testcase_29 AC 180 ms
15,600 KB
testcase_30 AC 181 ms
15,832 KB
testcase_31 AC 183 ms
15,732 KB
testcase_32 AC 157 ms
12,636 KB
testcase_33 AC 159 ms
12,504 KB
testcase_34 AC 156 ms
12,504 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "testlib.h"
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll=long long;
const ll MAXN=1000000000000000000ll;
const int MAXK=10000;
const int MAXQ=100000;
int main(int argc, char* argv[]){
    registerValidation(argc, argv);
    int k=inf.readInt(2, MAXK);
    inf.readSpace();
    int q=inf.readInt(1, MAXQ);
    inf.readEoln();
    ll n[100010];
    for(int i=0; i<q; i++){
        n[i]=inf.readLong(1ll, MAXN);
        inf.readEoln();
    }
    inf.readEof();
    
	vector<ll> v{1};
	while(v.back()<=MAXN){
		v.push_back(v.back()+(v.back()+k-2)/(k-1));
	}
	for(int i=0; i<q; i++){
		cout<<v[upper_bound(v.begin(), v.end(), n[i])-v.begin()-1]<<endl;
	}
    return 0;
}
0