結果

問題 No.1350 2019-6problem
ユーザー 👑 KazunKazun
提出日時 2021-04-30 03:03:38
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 74 ms / 2,000 ms
コード長 741 bytes
コンパイル時間 568 ms
コンパイル使用メモリ 86,712 KB
実行使用メモリ 71,504 KB
最終ジャッジ日時 2023-09-25 03:09:16
合計ジャッジ時間 4,909 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,468 KB
testcase_01 AC 69 ms
71,408 KB
testcase_02 AC 70 ms
71,416 KB
testcase_03 AC 69 ms
71,456 KB
testcase_04 AC 71 ms
71,340 KB
testcase_05 AC 73 ms
71,188 KB
testcase_06 AC 74 ms
71,188 KB
testcase_07 AC 69 ms
71,340 KB
testcase_08 AC 69 ms
71,336 KB
testcase_09 AC 70 ms
71,176 KB
testcase_10 AC 71 ms
71,464 KB
testcase_11 AC 72 ms
71,176 KB
testcase_12 AC 71 ms
71,252 KB
testcase_13 AC 70 ms
71,388 KB
testcase_14 AC 69 ms
71,200 KB
testcase_15 AC 71 ms
71,416 KB
testcase_16 AC 73 ms
71,504 KB
testcase_17 AC 71 ms
71,312 KB
testcase_18 AC 73 ms
71,340 KB
testcase_19 AC 70 ms
71,040 KB
testcase_20 AC 72 ms
71,316 KB
testcase_21 AC 70 ms
71,172 KB
testcase_22 AC 71 ms
71,336 KB
testcase_23 AC 72 ms
71,364 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def General_Binary_Increase_Search_Integer(L,R,cond,default=None):
    """条件式が単調増加であるとき, 整数上で二部探索を行う.
    L: 解の下限
    R: 解の上限
    cond: 条件(1変数関数, 広義単調増加を満たす)
    default: Lで条件を満たさないときの返り値
    """
    if not(cond(R)):
        return default

    if cond(L):
        return L

    R+=1
    while R-L>1:
        C=L+(R-L)//2
        if cond(C):
            R=C
        else:
            L=C
    return R
#================================================
from math import gcd

A,B,K=map(int,input().split())
L=A*B//gcd(A,B)
check=lambda x:(x//A+x//B-x//L)>=K

print(General_Binary_Increase_Search_Integer(1,A*K,check))
0