結果
| 問題 | No.1252 数字根D |
| コンテスト | |
| ユーザー |
yuusanlondon
|
| 提出日時 | 2020-10-09 22:06:01 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 273 bytes |
| 記録 | |
| コンパイル時間 | 145 ms |
| コンパイル使用メモリ | 85,204 KB |
| 実行使用メモリ | 138,472 KB |
| 最終ジャッジ日時 | 2026-04-02 23:25:23 |
| 合計ジャッジ時間 | 1,399 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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