結果

問題 No.2177 Recurring ab
ユーザー rlangevinrlangevin
提出日時 2023-01-24 00:49:32
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 447 bytes
コンパイル時間 501 ms
コンパイル使用メモリ 87,144 KB
実行使用メモリ 75,952 KB
最終ジャッジ日時 2023-09-08 01:07:43
合計ジャッジ時間 4,188 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
75,588 KB
testcase_01 AC 72 ms
75,372 KB
testcase_02 AC 74 ms
75,804 KB
testcase_03 AC 71 ms
75,564 KB
testcase_04 AC 72 ms
75,952 KB
testcase_05 AC 73 ms
75,832 KB
testcase_06 AC 74 ms
75,884 KB
testcase_07 AC 73 ms
75,840 KB
testcase_08 AC 72 ms
75,928 KB
testcase_09 AC 74 ms
75,700 KB
testcase_10 AC 75 ms
75,832 KB
testcase_11 AC 75 ms
75,824 KB
testcase_12 AC 75 ms
75,608 KB
testcase_13 AC 72 ms
75,744 KB
testcase_14 AC 74 ms
75,892 KB
testcase_15 AC 73 ms
75,780 KB
testcase_16 AC 75 ms
75,900 KB
testcase_17 AC 74 ms
75,608 KB
testcase_18 AC 74 ms
75,588 KB
testcase_19 AC 75 ms
75,740 KB
testcase_20 AC 76 ms
75,508 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(N, a, b, p):
    return N * (a * p + b) > p * p - 1

N = int(input())
ans = 0
for a in range(10):
    for b in range(10):
        if a == b:
            continue
        yes = 0
        no = 10 ** 9 + 1
        while no - yes != 1:
            mid = (yes + no)//2
            if f(N, a, b, mid):
                yes = mid
            else:
                no = mid
        ans += max(0, yes - max(a, b))
        # print(a, b, mid)
print(ans)
0