結果

問題 No.1252 数字根D
ユーザー taiga000629taiga000629
提出日時 2020-10-09 23:59:39
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 393 bytes
コンパイル時間 281 ms
コンパイル使用メモリ 86,872 KB
実行使用メモリ 78,048 KB
最終ジャッジ日時 2023-09-27 20:15:38
合計ジャッジ時間 2,437 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 65 ms
71,432 KB
testcase_01 AC 69 ms
71,284 KB
testcase_02 AC 68 ms
71,284 KB
testcase_03 AC 87 ms
76,184 KB
testcase_04 AC 103 ms
77,968 KB
testcase_05 AC 105 ms
77,912 KB
testcase_06 AC 104 ms
77,664 KB
testcase_07 AC 102 ms
77,792 KB
testcase_08 AC 100 ms
77,916 KB
testcase_09 AC 102 ms
77,948 KB
testcase_10 AC 102 ms
77,452 KB
testcase_11 AC 103 ms
78,048 KB
testcase_12 AC 101 ms
77,508 KB
testcase_13 AC 99 ms
77,980 KB
testcase_14 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

t=int(input())
ans=[]
for i in range(t):
    d,a,b=map(int,input().split())
    p=d-1
    T=p*(p+1)//2
    k=(a-1)//p
    l=(a-1)%p+1
    y=(b-1)//p
    z=(b-1)%p+1
    if k<y:
        res=T*(y-k-1)
        res+=(p-l+1)*(p+l)//2
        res+=z*(z+1)//2
        ans.append(res)
    else:
        res=0
        res+=(z-l+1)*(z+l)//2
        ans.append(res)
for i in range(t):
    print(ans[i])

0