結果
| 問題 | No.639 An Ordinary Sequence |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-08 08:41:39 |
| 言語 | Python3 (3.14.7 + numpy 2.5.2 + scipy 1.18.0 + ACL) |
| 結果 |
TLE
不安定
|
| 実行時間 | - |
| コード長 | 343 bytes |
| 記録 | |
| コンパイル時間 | 300 ms |
| コンパイル使用メモリ | 21,412 KB |
| 実行使用メモリ | 21,876 KB |
| 最終ジャッジ日時 | 2026-08-17 14:47:37 |
| 合計ジャッジ時間 | 5,706 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | -- * 2 |
| other | TLE * 1 -- * 16 |
ソースコード
# No.639 An Ordinary Sequence
import sys
sys.setrecursionlimit(10 ** 9)
def rec(x: int, memo: dict) -> int:
if x == 0:
return 1
if x in memo:
return memo[x]
return rec(x // 3, memo) + rec(x // 5, memo)
def main():
N = int(input())
memo = {}
print(rec(N, memo))
if __name__ == "__main__":
main()