結果
問題 | No.2526 Kth Not-divisible Number |
ユーザー |
|
提出日時 | 2023-11-03 22:09:19 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 523 ms / 2,000 ms |
コード長 | 412 bytes |
コンパイル時間 | 339 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 87,280 KB |
最終ジャッジ日時 | 2024-09-25 20:33:57 |
合計ジャッジ時間 | 6,464 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 11 |
ソースコード
import mathimport sysinput = sys.stdin.readlineT = int(input())ABK = [list(map(int, input().split())) for _ in range(T)]for a, b, k in ABK:g = math.gcd(a, b)l = a//g*bleft = 0right = 10**19while right-left>1:mid = (left+right)//2cnt = mid//a + mid//b - mid//(l)if mid-cnt>=k:right = midelse:left = midprint(right)