結果
問題 | No.639 An Ordinary Sequence |
ユーザー |
|
提出日時 | 2022-10-10 18:48:37 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 533 bytes |
コンパイル時間 | 2,016 ms |
コンパイル使用メモリ | 202,820 KB |
最終ジャッジ日時 | 2025-02-08 01:15:06 |
ジャッジサーバーID (参考情報) |
judge5 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h> #define rep(i,n) for(int i = 0; i < (n); i++) using namespace std; typedef long long ll; int main(){ cin.tie(0); ios::sync_with_stdio(0); ll N; cin >> N; map<ll,ll> mp; function<ll(ll)> dfs = [&](ll i) -> ll { if(i == 0) return 1LL; ll res = 0; for(ll x : {3, 5}) { if(mp.count(i / x)) res += mp[i / x]; else res += dfs(i / x); } return mp[i] = res; }; cout << dfs(N) << endl; }