結果
問題 | No.2526 Kth Not-divisible Number |
ユーザー | navel_tos |
提出日時 | 2023-11-04 13:53:38 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,282 ms / 2,000 ms |
コード長 | 475 bytes |
コンパイル時間 | 261 ms |
コンパイル使用メモリ | 81,876 KB |
実行使用メモリ | 76,844 KB |
最終ジャッジ日時 | 2023-11-04 13:53:51 |
合計ジャッジ時間 | 12,208 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 40 ms
53,808 KB |
testcase_01 | AC | 39 ms
53,808 KB |
testcase_02 | AC | 38 ms
53,808 KB |
testcase_03 | AC | 1,281 ms
76,712 KB |
testcase_04 | AC | 1,271 ms
76,716 KB |
testcase_05 | AC | 1,275 ms
76,712 KB |
testcase_06 | AC | 1,282 ms
76,712 KB |
testcase_07 | AC | 1,272 ms
76,712 KB |
testcase_08 | AC | 991 ms
76,712 KB |
testcase_09 | AC | 870 ms
76,712 KB |
testcase_10 | AC | 1,033 ms
76,712 KB |
testcase_11 | AC | 856 ms
76,844 KB |
ソースコード
#yukicoder411B gcd=lambda x,y: gcd(y,x%y) if x%y else y import math def solve(A,B,K): #二分探索を行う 値midはAでもBでも割り切れない正整数をK個以上有するか? ok,ng=10**19,0 while abs(ok-ng)>1: mid=(ok+ng)//2; cnt=mid cnt-=mid//A; cnt-=mid//B; cnt+=mid//math.lcm(A,B) ok,ng=(mid,ng) if cnt>=K else (ok,mid) return ok for _ in range(int(input())): A,B,K=map(int,input().split()); print(solve(A,B,K))