結果
問題 | No.639 An Ordinary Sequence |
ユーザー |
![]() |
提出日時 | 2019-03-03 00:49:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 354 bytes |
コンパイル時間 | 2,042 ms |
コンパイル使用メモリ | 170,340 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-01-02 02:41:01 |
合計ジャッジ時間 | 2,887 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 17 |
ソースコード
#include<bits/stdc++.h> using namespace std; #define int long long signed main(){ cin.tie(0); ios::sync_with_stdio(false); int n; cin >> n; map<int,int> dp; dp[0] = 1; function< int(int) > rec = [&](int i){ if(dp.find(i) != dp.end()) return dp[i]; return dp[i] = rec(i/3) + rec(i/5); }; cout << rec(n) << endl; return 0; }