結果

問題 No.1651 Removing Cards
ユーザー 夜
提出日時 2021-08-21 07:19:22
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 665 bytes
コンパイル時間 689 ms
コンパイル使用メモリ 90,360 KB
実行使用メモリ 5,964 KB
最終ジャッジ日時 2023-08-04 18:47:37
合計ジャッジ時間 8,588 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 176 ms
4,380 KB
testcase_12 AC 178 ms
4,380 KB
testcase_13 WA -
testcase_14 AC 180 ms
4,380 KB
testcase_15 AC 197 ms
5,852 KB
testcase_16 AC 196 ms
5,760 KB
testcase_17 AC 199 ms
5,888 KB
testcase_18 AC 188 ms
5,712 KB
testcase_19 AC 195 ms
5,916 KB
testcase_20 AC 202 ms
5,776 KB
testcase_21 AC 198 ms
5,776 KB
testcase_22 AC 198 ms
5,868 KB
testcase_23 WA -
testcase_24 AC 145 ms
4,376 KB
testcase_25 AC 166 ms
5,860 KB
testcase_26 AC 163 ms
5,728 KB
testcase_27 AC 200 ms
5,960 KB
testcase_28 AC 206 ms
5,864 KB
testcase_29 AC 189 ms
5,964 KB
testcase_30 AC 193 ms
5,956 KB
testcase_31 AC 207 ms
5,864 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 AC 172 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
long long sum[400000];
long long INF = 1000000000000000007;
int main() {
	long long k, q;
	cin >> k >> q;
	sum[0] = 1;
	long long s = 1, i1 = 1;
	for (;;i1++) {
		if (s >= INF)break;
		s += (s + k - 2) / (k - 1);
		sum[i1] = s;
	}
	i1++;
	for (int i = 0; i < q; i++) {
		long long n;
		cin >> n;
		auto itr = upper_bound(sum, sum + i1, n);
		itr--;
		cout << *itr << endl;
	}
}
0