結果
| 問題 | No.415 ぴょん |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-08-26 22:54:04 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 545 bytes |
| 記録 | |
| コンパイル時間 | 214 ms |
| コンパイル使用メモリ | 85,312 KB |
| 実行使用メモリ | 88,328 KB |
| 最終ジャッジ日時 | 2026-05-08 15:50:09 |
| 合計ジャッジ時間 | 3,082 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 3 TLE * 1 -- * 23 |
ソースコード
import array
def solve():
n, d = map(int, input().split())
if d == 1:
print(n - 1)
return
elif n % d == 0:
print(n // d - 1)
return
visited = array.array("L")
now, ans = 0, 0
while True:
visited.append(now)
t = now
now = (n + now + d) % d
ans += (n - t) // d + 1 if (n - t) % d != 0 else (n - t) // d
# print(visited, now, ans)
if now in visited:
ans -= 1
break
print(ans)
if __name__=="__main__":
solve()