結果

問題 No.1651 Removing Cards
ユーザー pengin_2000pengin_2000
提出日時 2021-08-20 22:42:17
言語 C
(gcc 12.3.0)
結果
TLE  
実行時間 -
コード長 377 bytes
コンパイル時間 251 ms
コンパイル使用メモリ 29,696 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-04-22 05:37:43
合計ジャッジ時間 6,327 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
10,752 KB
testcase_01 AC 1 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 1 ms
5,376 KB
testcase_07 AC 1 ms
5,376 KB
testcase_08 AC 1 ms
5,376 KB
testcase_09 AC 106 ms
5,376 KB
testcase_10 AC 157 ms
5,376 KB
testcase_11 AC 205 ms
5,376 KB
testcase_12 AC 257 ms
5,376 KB
testcase_13 AC 307 ms
5,376 KB
testcase_14 AC 352 ms
5,376 KB
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
int main()
{
	long long int k, Q;
	scanf("%lld %lld", &k, &Q);
	long long int i, p, q;
	long long int n;
	for (; Q > 0; Q--)
	{
		scanf("%lld", &n);
		for (i = 1; i < n;)
		{
			p = (i + 1) / (k - 1);
			q = (i + 1) % (k - 1);
			if (q == 0)
			{
				p--;
				q += k - 1;
			}
			i = k * p + q;
		}
		i -= i / k + 1;
		printf("%lld\n", i + 1);
	}
	return 0;
}
0