結果
| 問題 |
No.2526 Kth Not-divisible Number
|
| コンテスト | |
| ユーザー |
nonon
|
| 提出日時 | 2024-09-10 10:08:00 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 349 bytes |
| コンパイル時間 | 380 ms |
| コンパイル使用メモリ | 82,252 KB |
| 実行使用メモリ | 78,440 KB |
| 最終ジャッジ日時 | 2024-09-10 10:08:26 |
| 合計ジャッジ時間 | 24,931 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 2 TLE * 9 |
ソースコード
def gcd(a,b):
if b==0:
return a
return gcd(b,a%b)
def lcm(a,b):
return (a*b)//gcd(a,b)
for _ in range(int(input())):
A,B,K=map(int,input().split())
C=lcm(A,B)
L,R=0,1<<65
while R-L>1:
mid=(L+R)//2
cnt=mid-(mid//A+mid//B-mid//C)
if cnt>=K:
R=mid
else:
L=mid
print(R)
nonon