結果

問題 No.1651 Removing Cards
ユーザー chocoruskchocorusk
提出日時 2021-06-20 18:12:04
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 219 ms / 2,000 ms
コード長 359 bytes
コンパイル時間 981 ms
コンパイル使用メモリ 80,124 KB
実行使用メモリ 7,632 KB
最終ジャッジ日時 2024-04-22 03:22:50
合計ジャッジ時間 8,269 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 5 ms
5,376 KB
testcase_03 AC 1 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 1 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 210 ms
5,376 KB
testcase_10 AC 184 ms
5,376 KB
testcase_11 AC 188 ms
5,376 KB
testcase_12 AC 200 ms
5,376 KB
testcase_13 AC 197 ms
5,376 KB
testcase_14 AC 196 ms
5,376 KB
testcase_15 AC 213 ms
7,500 KB
testcase_16 AC 213 ms
7,632 KB
testcase_17 AC 213 ms
7,624 KB
testcase_18 AC 210 ms
7,500 KB
testcase_19 AC 212 ms
7,632 KB
testcase_20 AC 212 ms
7,628 KB
testcase_21 AC 209 ms
7,496 KB
testcase_22 AC 204 ms
7,632 KB
testcase_23 AC 202 ms
5,376 KB
testcase_24 AC 168 ms
5,376 KB
testcase_25 AC 193 ms
7,624 KB
testcase_26 AC 193 ms
7,628 KB
testcase_27 AC 209 ms
7,500 KB
testcase_28 AC 219 ms
7,372 KB
testcase_29 AC 208 ms
7,496 KB
testcase_30 AC 213 ms
7,624 KB
testcase_31 AC 203 ms
7,496 KB
testcase_32 AC 169 ms
5,376 KB
testcase_33 AC 170 ms
5,376 KB
testcase_34 AC 169 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll=long long;
const ll MAX=1e18;
int main()
{
	int k, q;
	cin>>k>>q;
	vector<ll> v{1};
	while(v.back()<=MAX){
		v.push_back(v.back()+(v.back()+k-2)/(k-1));
	}
	while(q--){
		ll n;
		cin>>n;
		cout<<v[upper_bound(v.begin(), v.end(), n)-v.begin()-1]<<endl;
	}
    return 0;
}
0