結果
| 問題 |
No.2526 Kth Not-divisible Number
|
| コンテスト | |
| ユーザー |
Koi
|
| 提出日時 | 2023-11-03 21:43:28 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
TLE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 537 bytes |
| コンパイル時間 | 249 ms |
| コンパイル使用メモリ | 82,944 KB |
| 実行使用メモリ | 85,504 KB |
| 最終ジャッジ日時 | 2024-09-25 19:49:35 |
| 合計ジャッジ時間 | 20,337 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 3 TLE * 8 |
ソースコード
import math
T=int(input())
answers=[]
def solve(A,B,K):
c=math.lcm(A,B)
ng=0
ok=10**19
while (ok-ng)>1:
m=(ok+ng)//2
if(m-(m//B)-(m//A)+(m//c)>=K):
ok=m
else:
ng=m
return ok
def gutyoku(A,B,K):
ans=0
while K>0:
ans+=1
if(ans%A==0 or ans%B==0):
continue
else:
K-=1
return ans
for i in range(T):
A,B,K=map(int,input().split())
ans=solve(A,B,K)
answers.append(ans)
for ans in answers:
print(ans)
Koi