結果
問題 |
No.639 An Ordinary Sequence
|
ユーザー |
![]() |
提出日時 | 2025-05-01 02:44:31 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 3 ms / 1,000 ms |
コード長 | 548 bytes |
コンパイル時間 | 3,757 ms |
コンパイル使用メモリ | 278,728 KB |
実行使用メモリ | 7,844 KB |
最終ジャッジ日時 | 2025-05-01 02:44:36 |
合計ジャッジ時間 | 5,053 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h> using namespace std; using i64 = long long; int main() { cin.tie(nullptr)->sync_with_stdio(false); auto solve = [&]() { i64 n; cin >> n; map<i64, i64> mp; auto f = [&](auto f, i64 n) -> i64 { if (n == 0) { return 1; } if (mp.count(n)) { return mp[n]; } return mp[n] = f(f, n / 3) + f(f, n / 5); }; cout << f(f, n) << '\n'; }; solve(); return 0; }