結果

問題 No.1252 数字根D
ユーザー kozykozy
提出日時 2020-10-09 21:30:47
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 407 bytes
コンパイル時間 398 ms
コンパイル使用メモリ 10,856 KB
実行使用メモリ 7,880 KB
最終ジャッジ日時 2023-09-27 14:47:08
合計ジャッジ時間 1,198 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 13 ms
7,804 KB
testcase_01 AC 13 ms
7,860 KB
testcase_02 AC 15 ms
7,740 KB
testcase_03 AC 22 ms
7,868 KB
testcase_04 AC 29 ms
7,852 KB
testcase_05 AC 26 ms
7,744 KB
testcase_06 AC 26 ms
7,824 KB
testcase_07 AC 27 ms
7,808 KB
testcase_08 AC 26 ms
7,848 KB
testcase_09 AC 27 ms
7,816 KB
testcase_10 AC 27 ms
7,788 KB
testcase_11 AC 26 ms
7,800 KB
testcase_12 AC 27 ms
7,736 KB
testcase_13 AC 26 ms
7,880 KB
testcase_14 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def suti(S):
    if S%d==0:
        return d
    else:
        return S%d
Q=int(input())
for i in range(Q):
    d,a,b=map(int,input().split())
    d-=1
    s=(b-a)//d
    ans=(((1+d)*d)//2)*s
    a=suti(a)
    b=suti(b)
    if a<b:
        ans+=((b-a+1)*(b+a))//2
        print(ans)
    elif a==b:
        print(ans+a)
    else:
        ans+=((d-a+1)*(d+a))//2
        ans+=((b)*(b+1))//2
        print(ans)
0