結果

問題 No.1252 数字根D
ユーザー trineutron
提出日時 2020-10-09 21:46:21
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 47 ms / 2,000 ms
コード長 266 bytes
コンパイル時間 967 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 10,752 KB
最終ジャッジ日時 2024-07-20 10:25:48
合計ジャッジ時間 1,581 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 14
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(n, d):
    q = n // d
    r = n % d
    return q * d * (d + 1) // 2 + r * (r + 1) // 2

def solve():
    d, a, b = map(int, input().split())
    if a == 0:
        a = 1
    print(f(b, d - 1) - f(a - 1, d - 1))

t = int(input())
for i in range(t):
    solve()
0