結果
問題 | No.639 An Ordinary Sequence |
ユーザー |
|
提出日時 | 2018-09-19 05:13:45 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 473 bytes |
コンパイル時間 | 1,422 ms |
コンパイル使用メモリ | 167,168 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-01-02 02:32:54 |
合計ジャッジ時間 | 2,157 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i=a;i<b;i++) #define int long long const int inf = 100100100100100; const int mod = 1000000007; map<int,int> mp; int dfs(int i){ if(i == 0) return 1; if(mp.find(i) != mp.end()) return mp[i]; mp[i] = dfs(i/3) + dfs(i/5); return mp[i]; } signed main(){ std::ios::sync_with_stdio(false); std::cin.tie(0); int n; cin >> n; cout << dfs(n) << endl; return 0; }