結果

問題 No.1252 数字根D
ユーザー convexineqconvexineq
提出日時 2020-12-21 21:54:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 213 bytes
コンパイル時間 365 ms
コンパイル使用メモリ 81,756 KB
実行使用メモリ 75,952 KB
最終ジャッジ日時 2023-10-21 11:51:55
合計ジャッジ時間 2,591 ms
ジャッジサーバーID
(参考情報)
judge12 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 38 ms
53,560 KB
testcase_01 AC 39 ms
53,560 KB
testcase_02 AC 39 ms
53,560 KB
testcase_03 AC 64 ms
68,140 KB
testcase_04 AC 87 ms
75,944 KB
testcase_05 AC 87 ms
75,940 KB
testcase_06 AC 88 ms
75,940 KB
testcase_07 AC 87 ms
75,940 KB
testcase_08 AC 87 ms
75,940 KB
testcase_09 AC 88 ms
75,940 KB
testcase_10 AC 88 ms
75,940 KB
testcase_11 AC 91 ms
75,944 KB
testcase_12 AC 89 ms
75,944 KB
testcase_13 AC 87 ms
75,952 KB
testcase_14 AC 38 ms
53,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def solve(d,x):
    if x <= 0: return 0
    p,q = x//(d-1), x%(d-1)
    return d*(d-1)//2*p + q*(q+1)//2

T = int(input())
for _ in range(T):
    d,a,b = map(int,input().split())
    print(solve(d,b)-solve(d,a-1))
0