結果

問題 No.1651 Removing Cards
ユーザー chocoruskchocorusk
提出日時 2021-06-20 18:14:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 374 bytes
コンパイル時間 676 ms
コンパイル使用メモリ 80,372 KB
実行使用メモリ 9,296 KB
最終ジャッジ日時 2024-04-22 03:22:34
合計ジャッジ時間 7,956 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 WA -
testcase_02 AC 4 ms
5,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 AC 180 ms
5,376 KB
testcase_10 AC 182 ms
5,376 KB
testcase_11 AC 179 ms
5,376 KB
testcase_12 AC 181 ms
5,376 KB
testcase_13 AC 179 ms
5,376 KB
testcase_14 AC 185 ms
5,376 KB
testcase_15 AC 206 ms
7,624 KB
testcase_16 AC 213 ms
7,504 KB
testcase_17 AC 205 ms
7,500 KB
testcase_18 AC 212 ms
7,508 KB
testcase_19 AC 204 ms
7,500 KB
testcase_20 AC 209 ms
7,500 KB
testcase_21 AC 200 ms
7,628 KB
testcase_22 AC 206 ms
7,500 KB
testcase_23 AC 194 ms
5,376 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 210 ms
7,500 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
権限があれば一括ダウンロードができます

ソースコード

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[max(0, (int)(lower_bound(v.begin(), v.end(), n)-v.begin())-1)]<<endl;
	}
    return 0;
}
0