結果
| 問題 |
No.639 An Ordinary Sequence
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-08 08:41:39 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 343 bytes |
| コンパイル時間 | 78 ms |
| コンパイル使用メモリ | 12,672 KB |
| 実行使用メモリ | 21,376 KB |
| 最終ジャッジ日時 | 2024-07-18 18:55:45 |
| 合計ジャッジ時間 | 4,571 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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()