結果

問題 No.2526 Kth Not-divisible Number
ユーザー 👑 p-adicp-adic
提出日時 2023-07-07 00:16:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,079 ms / 2,000 ms
コード長 226 bytes
コンパイル時間 328 ms
コンパイル使用メモリ 81,868 KB
実行使用メモリ 76,736 KB
最終ジャッジ日時 2023-11-03 21:28:19
合計ジャッジ時間 7,097 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,616 KB
testcase_01 AC 36 ms
53,620 KB
testcase_02 AC 36 ms
53,620 KB
testcase_03 AC 546 ms
76,036 KB
testcase_04 AC 544 ms
76,036 KB
testcase_05 AC 559 ms
76,124 KB
testcase_06 AC 547 ms
76,036 KB
testcase_07 AC 547 ms
76,036 KB
testcase_08 AC 521 ms
76,060 KB
testcase_09 AC 1,079 ms
76,736 KB
testcase_10 AC 607 ms
76,116 KB
testcase_11 AC 328 ms
76,080 KB
権限があれば一括ダウンロードができます

ソースコード

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