結果

問題 No.1350 2019-6problem
ユーザー ryusukeryusuke
提出日時 2022-01-30 16:20:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 72 ms / 2,000 ms
コード長 332 bytes
コンパイル時間 368 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 71,772 KB
最終ジャッジ日時 2023-09-02 01:40:50
合計ジャッジ時間 3,035 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,696 KB
testcase_01 AC 70 ms
71,268 KB
testcase_02 AC 71 ms
71,284 KB
testcase_03 AC 72 ms
71,284 KB
testcase_04 AC 71 ms
71,268 KB
testcase_05 AC 71 ms
71,436 KB
testcase_06 AC 71 ms
71,436 KB
testcase_07 AC 69 ms
71,448 KB
testcase_08 AC 70 ms
71,772 KB
testcase_09 AC 69 ms
71,536 KB
testcase_10 AC 69 ms
71,716 KB
testcase_11 AC 69 ms
71,388 KB
testcase_12 AC 71 ms
71,364 KB
testcase_13 AC 71 ms
71,264 KB
testcase_14 AC 69 ms
71,340 KB
testcase_15 AC 70 ms
71,528 KB
testcase_16 AC 71 ms
71,260 KB
testcase_17 AC 71 ms
71,364 KB
testcase_18 AC 72 ms
71,280 KB
testcase_19 AC 71 ms
71,752 KB
testcase_20 AC 70 ms
71,708 KB
testcase_21 AC 71 ms
71,128 KB
testcase_22 AC 72 ms
71,280 KB
testcase_23 AC 71 ms
71,436 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from math import gcd

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

'''
答えをkとする
<=> k以下の自然数でa, bの倍数がk個ある
'''

l, r = 0, 10 ** 18 + 1
while r - l > 1:
    mid = (r + l) // 2
    cnt = mid // a + mid // b - mid // (a * b // gcd(a, b))
    if cnt >= k:
        r = mid
    else:
        l = mid

print(r)
0