結果
| 問題 |
No.1252 数字根D
|
| コンテスト | |
| ユーザー |
Kude
|
| 提出日時 | 2020-10-09 21:57:20 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 106 ms / 2,000 ms |
| コード長 | 239 bytes |
| コンパイル時間 | 220 ms |
| コンパイル使用メモリ | 82,688 KB |
| 実行使用メモリ | 76,380 KB |
| 最終ジャッジ日時 | 2024-07-20 11:04:49 |
| 合計ジャッジ時間 | 2,112 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 14 |
ソースコード
def g(d, x):
if x <= 0:
return 0
n, x = divmod(x, d - 1)
return n * d * (d - 1) // 2 + x * (x + 1) // 2
for _ in range(int(input())):
d, a, b = map(int, input().split())
ans = g(d, b) - g(d, a-1)
print(ans)
Kude