結果

問題 No.2177 Recurring ab
ユーザー tassei903tassei903
提出日時 2023-01-06 22:47:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 87 ms / 2,000 ms
コード長 738 bytes
コンパイル時間 337 ms
コンパイル使用メモリ 87,084 KB
実行使用メモリ 76,240 KB
最終ジャッジ日時 2023-08-20 16:10:22
合計ジャッジ時間 3,254 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 82 ms
76,060 KB
testcase_01 AC 80 ms
76,048 KB
testcase_02 AC 87 ms
76,132 KB
testcase_03 AC 81 ms
76,208 KB
testcase_04 AC 81 ms
76,220 KB
testcase_05 AC 82 ms
76,216 KB
testcase_06 AC 83 ms
75,848 KB
testcase_07 AC 83 ms
76,120 KB
testcase_08 AC 83 ms
75,800 KB
testcase_09 AC 83 ms
75,916 KB
testcase_10 AC 84 ms
76,208 KB
testcase_11 AC 82 ms
76,072 KB
testcase_12 AC 84 ms
75,856 KB
testcase_13 AC 83 ms
76,068 KB
testcase_14 AC 84 ms
76,140 KB
testcase_15 AC 85 ms
76,164 KB
testcase_16 AC 80 ms
76,228 KB
testcase_17 AC 84 ms
76,016 KB
testcase_18 AC 86 ms
76,196 KB
testcase_19 AC 84 ms
76,240 KB
testcase_20 AC 84 ms
76,024 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = lambda :sys.stdin.readline()[:-1]
ni = lambda :int(input())
na = lambda :list(map(int,input().split()))
yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES")
no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO")
#######################################################################
n = ni()
ans = 0
for a in range(10):
    for b in range(10):
        if a == b:
            continue
        l = max(a,b)
        ok = 1
        ng = 10**18
        while abs(ok - ng) > 1:
            d = ok+ng>>1
            if (d * a + b)*n > d ** 2 - 1:
                ok = d
            else:
                ng = d
        #print(a,b,l,ok)
        ans += max(ok-l, 0)
print(ans)
0