結果

問題 No.1350 2019-6problem
ユーザー wgrape
提出日時 2023-10-31 16:04:11
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 327 bytes
コンパイル時間 295 ms
コンパイル使用メモリ 82,212 KB
実行使用メモリ 52,680 KB
最終ジャッジ日時 2024-09-25 17:41:09
合計ジャッジ時間 2,197 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

A,B,K = map(int,input().split())
import math
G = A // math.gcd(A, B) * B

def is_ok(x): # x以下の数をK個以上作れたらOK
    return ((x // A) + (x // B) - (x // G)) >= K
    
ok = 10 ** 18 + 1
ng = 0

while ok - ng > 1:
    mid = (ok + ng) // 2
    if is_ok(mid):
        ok = mid
    else:
        ng = mid
print(ok)
0