結果
問題 | No.639 An Ordinary Sequence |
ユーザー |
![]() |
提出日時 | 2018-01-26 23:10:49 |
言語 | C++11 (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 977 bytes |
コンパイル時間 | 1,663 ms |
コンパイル使用メモリ | 161,484 KB |
実行使用メモリ | 6,820 KB |
最終ジャッジ日時 | 2025-01-02 02:09:45 |
合計ジャッジ時間 | 1,929 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 17 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define pb push_back#define all(x) (x).begin(),(x).end()#define YES() printf("YES\n")#define NO() printf("NO\n")#define Yes() printf("Yes\n")#define No() printf("No\n")#define in(x,y,h,w) x >= 0 && x < h && y >= 0 && y < w#define int long long//typedef long long ll;typedef vector<bool> vb;typedef vector<int> vi;typedef vector<vb> vvb;typedef vector<vi> vvi;typedef pair<int,int> P;template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); }template <typename T> T &chmax(T &a, const T &b) { return a = max(a, b); }const int INF=1e+9;const double EPS=1e-9;const int MOD=1000000007;const int dx[]={1,0,-1,0},dy[]={0,-1,0,1};map<int,int> mp;int calc(int x){if(!x) return 1;if(mp[x]) return mp[x];return mp[x] = calc(x / 3) + calc(x / 5);}signed main(){int n;cin >> n;cout << calc(n) << endl;return 0;}