結果

問題 No.1350 2019-6problem
ユーザー brthyyjpbrthyyjp
提出日時 2021-02-02 20:05:55
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 113 ms / 2,000 ms
コード長 375 bytes
コンパイル時間 302 ms
コンパイル使用メモリ 87,132 KB
実行使用メモリ 72,392 KB
最終ジャッジ日時 2023-09-12 11:21:10
合計ジャッジ時間 4,185 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 107 ms
72,280 KB
testcase_01 AC 108 ms
72,164 KB
testcase_02 AC 113 ms
72,368 KB
testcase_03 AC 106 ms
72,168 KB
testcase_04 AC 105 ms
72,240 KB
testcase_05 AC 105 ms
72,320 KB
testcase_06 AC 108 ms
72,084 KB
testcase_07 AC 107 ms
72,072 KB
testcase_08 AC 104 ms
71,976 KB
testcase_09 AC 105 ms
72,084 KB
testcase_10 AC 106 ms
71,968 KB
testcase_11 AC 104 ms
72,156 KB
testcase_12 AC 107 ms
72,160 KB
testcase_13 AC 105 ms
72,348 KB
testcase_14 AC 105 ms
72,152 KB
testcase_15 AC 105 ms
72,104 KB
testcase_16 AC 105 ms
72,152 KB
testcase_17 AC 105 ms
72,392 KB
testcase_18 AC 106 ms
72,284 KB
testcase_19 AC 106 ms
72,352 KB
testcase_20 AC 106 ms
72,312 KB
testcase_21 AC 103 ms
72,260 KB
testcase_22 AC 107 ms
71,972 KB
testcase_23 AC 105 ms
72,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a,b,k = map(int, input().split())

import math
from functools import reduce
def lcm_base(x, y):
    return (x * y) // math.gcd(x, y)

l =lcm_base(a,b)

def is_ok(x):
    t = x//a+x//b-x//l
    if t >= k:
        return True
    else:
        return False

ng = 0
ok = a*k
while ng+1 < ok:
    c = (ng+ok)//2
    if is_ok(c):
        ok = c
    else:
        ng = c
print(ok)
0