結果

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

テストケース

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

ソースコード

diff #

I=input
def f():
	return N-N//A-N//B+N//C
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 f()>=K:N-=1
	while f()<K:N+=1
	print(N)
0