結果
| 問題 |
No.1252 数字根D
|
| コンテスト | |
| ユーザー |
yuusanlondon
|
| 提出日時 | 2020-10-09 22:06:01 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 273 bytes |
| コンパイル時間 | 183 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 76,416 KB |
| 最終ジャッジ日時 | 2024-07-20 11:32:42 |
| 合計ジャッジ時間 | 1,935 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 13 WA * 1 |
ソースコード
t=int(input())
for _ in range(t):
d,a,b=map(int,input().split())
ans=b-a+1
a-=1
b-=1
first=a%(d-1)
last=b%(d-1)
ans+=(((d-2)*(d-1))//2)*(b//(d-1))
ans-=(((d-2)*(d-1))//2)*(a//(d-1))
ans+=((last*(last+1))//2)
ans-=((first*(first-1))//2)
print(ans)
yuusanlondon