結果
問題 | No.2526 Kth Not-divisible Number |
ユーザー |
![]() |
提出日時 | 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 mathT=int(input())answers=[]def solve(A,B,K):c=math.lcm(A,B)ng=0ok=10**19while (ok-ng)>1:m=(ok+ng)//2if(m-(m//B)-(m//A)+(m//c)>=K):ok=melse:ng=mreturn okdef gutyoku(A,B,K):ans=0while K>0:ans+=1if(ans%A==0 or ans%B==0):continueelse:K-=1return ansfor 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)