結果

問題 No.1252 数字根D
ユーザー 👑 KazunKazun
提出日時 2020-09-18 03:47:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 109 ms / 2,000 ms
コード長 207 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 86,704 KB
実行使用メモリ 77,048 KB
最終ジャッジ日時 2023-09-04 08:21:17
合計ジャッジ時間 3,481 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 75 ms
71,280 KB
testcase_01 AC 73 ms
71,284 KB
testcase_02 AC 74 ms
71,272 KB
testcase_03 AC 88 ms
75,544 KB
testcase_04 AC 102 ms
76,820 KB
testcase_05 AC 100 ms
76,664 KB
testcase_06 AC 107 ms
76,756 KB
testcase_07 AC 108 ms
76,844 KB
testcase_08 AC 109 ms
76,600 KB
testcase_09 AC 109 ms
77,048 KB
testcase_10 AC 108 ms
76,808 KB
testcase_11 AC 108 ms
76,808 KB
testcase_12 AC 109 ms
76,756 KB
testcase_13 AC 109 ms
76,816 KB
testcase_14 AC 76 ms
71,232 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def g(N):
    Q,R=divmod(N,D-1)
    return Q*(D*(D-1))//2+(R*(R+1))//2

T=int(input())

X=[0]*T
for k in range(T):
    D,A,B=map(int,input().split())
    X[k]=g(B)-g(max(A-1,0))

print("\n".join(map(str,X)))
0