結果
問題 | No.2526 Kth Not-divisible Number |
ユーザー | flygon |
提出日時 | 2023-11-03 21:32:35 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 525 ms / 2,000 ms |
コード長 | 544 bytes |
コンパイル時間 | 170 ms |
コンパイル使用メモリ | 82,448 KB |
実行使用メモリ | 78,624 KB |
最終ジャッジ日時 | 2024-09-25 19:25:39 |
合計ジャッジ時間 | 6,430 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 |
other | AC * 11 |
ソースコード
import sys sys.setrecursionlimit(5*10**5) input = sys.stdin.readline from collections import defaultdict, deque, Counter from heapq import heappop, heappush from bisect import bisect_left, bisect_right from math import gcd def sol(): a,b,k = map(int,input().split()) ab = a*b//gcd(a,b) l = 0 r = 4*10**18 for i in range(70): m = (l+r)//2 cnt = m-m//a-m//b+m//ab if cnt < k: l = m else: r = m print(*[r]) return T = int(input()) for i in range(T): sol()