結果

問題 No.1252 数字根D
ユーザー H3PO4H3PO4
提出日時 2022-02-03 09:00:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 288 bytes
コンパイル時間 89 ms
コンパイル使用メモリ 10,808 KB
実行使用メモリ 8,396 KB
最終ジャッジ日時 2023-09-02 03:05:12
合計ジャッジ時間 1,270 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
7,860 KB
testcase_01 AC 15 ms
7,844 KB
testcase_02 AC 15 ms
7,848 KB
testcase_03 AC 18 ms
7,956 KB
testcase_04 AC 21 ms
8,280 KB
testcase_05 AC 21 ms
8,396 KB
testcase_06 AC 19 ms
8,252 KB
testcase_07 AC 18 ms
8,224 KB
testcase_08 AC 20 ms
8,392 KB
testcase_09 AC 20 ms
8,300 KB
testcase_10 AC 21 ms
8,248 KB
testcase_11 AC 18 ms
8,244 KB
testcase_12 AC 18 ms
8,384 KB
testcase_13 AC 20 ms
8,364 KB
testcase_14 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

input = sys.stdin.buffer.readline


def g(d, x):
    div, mod = divmod(x, d - 1)
    return div * d * (d - 1) // 2 + mod * (mod + 1) // 2


def solve(d, A, B):
    return g(d, B) - g(d, A - 1)


T = int(input())
for _ in range(T):
    print(solve(*map(int, input().split())))
0