結果

問題 No.1918 Simple Math ?
ユーザー qibqib
提出日時 2022-11-10 16:23:25
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 333 bytes
コンパイル時間 414 ms
コンパイル使用メモリ 87,036 KB
実行使用メモリ 80,660 KB
最終ジャッジ日時 2023-10-01 00:54:12
合計ジャッジ時間 13,481 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 120 ms
80,168 KB
testcase_01 AC 83 ms
76,216 KB
testcase_02 AC 82 ms
75,996 KB
testcase_03 AC 83 ms
76,248 KB
testcase_04 AC 83 ms
76,176 KB
testcase_05 AC 82 ms
75,976 KB
testcase_06 TLE -
testcase_07 TLE -
testcase_08 AC 1,492 ms
76,168 KB
testcase_09 AC 649 ms
76,256 KB
testcase_10 TLE -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import math

MOD = 10 ** 9 + 7

t = int(input())
for _ in range(t):
  a, n = map(int, input().split())

  ans = 0
  for x in range(1, int(math.sqrt(n * a)) + 1):
    lb = (x * x + a - 1) // a
    ub = min(n + 1, ((x + 1) * (x + 1) + a - 1) // a)
    if ub - lb <= 0:
      continue
    ans = (ans + (ub - lb) * x) % MOD

  print(ans)
0