結果

問題 No.1252 数字根D
ユーザー KudeKude
提出日時 2020-10-09 21:57:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 121 ms / 2,000 ms
コード長 239 bytes
コンパイル時間 408 ms
コンパイル使用メモリ 86,944 KB
実行使用メモリ 78,488 KB
最終ジャッジ日時 2023-09-27 16:47:11
合計ジャッジ時間 2,881 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,316 KB
testcase_01 AC 74 ms
71,408 KB
testcase_02 AC 74 ms
71,144 KB
testcase_03 AC 99 ms
76,536 KB
testcase_04 AC 121 ms
78,388 KB
testcase_05 AC 120 ms
78,488 KB
testcase_06 AC 118 ms
78,352 KB
testcase_07 AC 117 ms
78,240 KB
testcase_08 AC 116 ms
78,296 KB
testcase_09 AC 120 ms
78,272 KB
testcase_10 AC 120 ms
78,268 KB
testcase_11 AC 119 ms
78,192 KB
testcase_12 AC 116 ms
78,224 KB
testcase_13 AC 119 ms
78,416 KB
testcase_14 AC 72 ms
71,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def g(d, x):
    if x <= 0:
        return 0
    n, x = divmod(x, d - 1)

    return n * d * (d - 1) // 2 + x * (x + 1) // 2
for _ in range(int(input())):
    d, a, b = map(int, input().split())
    ans = g(d, b) - g(d, a-1)
    print(ans)
0