結果

問題 No.2526 Kth Not-divisible Number
ユーザー 👑 p-adicp-adic
提出日時 2023-07-07 00:01:18
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 228 bytes
コンパイル時間 213 ms
コンパイル使用メモリ 11,900 KB
実行使用メモリ 14,424 KB
最終ジャッジ日時 2023-11-03 21:28:08
合計ジャッジ時間 4,860 ms
ジャッジサーバーID
(参考情報)
judge10 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,056 KB
testcase_01 AC 31 ms
10,056 KB
testcase_02 AC 30 ms
10,056 KB
testcase_03 TLE -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

I=input
for t in range(int(I())):
	A,B,K=map(int,I().split())
	C,D=A,B
	if A>B:C,D=D,C
	while C:C,D=D%C,C
	C=A*B//D
	N=int((K+1)/(1-1/A-1/B+1/C))
	while N-N//A-N//B+N//C>=K:N-=1
	while N-N//A-N//B+N//C<K:N+=1
	print(N)
0