結果

問題 No.2177 Recurring ab
ユーザー とりゐとりゐ
提出日時 2023-01-06 21:52:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 98 ms / 2,000 ms
コード長 313 bytes
コンパイル時間 2,026 ms
コンパイル使用メモリ 86,952 KB
実行使用メモリ 75,644 KB
最終ジャッジ日時 2023-08-20 14:57:31
合計ジャッジ時間 4,601 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
75,400 KB
testcase_01 AC 88 ms
75,628 KB
testcase_02 AC 92 ms
75,304 KB
testcase_03 AC 98 ms
75,520 KB
testcase_04 AC 93 ms
75,412 KB
testcase_05 AC 94 ms
75,292 KB
testcase_06 AC 93 ms
75,508 KB
testcase_07 AC 93 ms
75,552 KB
testcase_08 AC 93 ms
75,428 KB
testcase_09 AC 94 ms
75,408 KB
testcase_10 AC 95 ms
75,284 KB
testcase_11 AC 92 ms
75,516 KB
testcase_12 AC 95 ms
75,276 KB
testcase_13 AC 95 ms
75,548 KB
testcase_14 AC 94 ms
75,540 KB
testcase_15 AC 97 ms
75,644 KB
testcase_16 AC 96 ms
75,412 KB
testcase_17 AC 93 ms
75,272 KB
testcase_18 AC 96 ms
75,568 KB
testcase_19 AC 96 ms
75,408 KB
testcase_20 AC 93 ms
75,368 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
'''
x=(a*p+b)/(p*p-1)
'''
ans=0
for a in range(10):
  for b in range(10):
    if a==b:
      continue
    m=max(a+1,b+1,2)
    ng,ok=10**9+1,m-1
    while abs(ng-ok)>1:
      p=(ng+ok)//2
      if n*(a*p+b)>p*p-1:
        ok=p
      else:
        ng=p
    #print(a,b,p-m)
    ans+=ok-m+1
print(ans)
0