結果
| 問題 | No.639 An Ordinary Sequence | 
| コンテスト | |
| ユーザー |  amtgjw | 
| 提出日時 | 2018-06-14 12:46:35 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 1,000 ms | 
| コード長 | 839 bytes | 
| コンパイル時間 | 944 ms | 
| コンパイル使用メモリ | 75,180 KB | 
| 実行使用メモリ | 6,820 KB | 
| 最終ジャッジ日時 | 2025-01-02 02:30:41 | 
| 合計ジャッジ時間 | 1,429 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 17 | 
ソースコード
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <numeric>
#include <map>
using namespace std;
#define REP(i,n)	for(int i=0;i<(n);++i)
#define REPS(i,s,t)	for(int i=(s);i<(t);++i)
#define SUMV(v)		(accumulate(v.begin(),v.end(),0.0))
#define INF 		2000000007
#define MOD			998244353
#define MAX 		100005
typedef unsigned int 			uint;
typedef unsigned long long int	ull;
typedef long long int ll;
//uint dp[MAX];
map<ll,uint> dp;
uint fun(ll n){
	if(n==0) return 1;
	uint a,b;
	auto itr = dp.find(n/3);
	if(itr != dp.end()){
		a = itr->second;
	}else{
		a = fun(n/3);
		dp[n/3] = a;
	}
	auto itr2 = dp.find(n/5);
	if(itr2 != dp.end()){
		b = itr2->second;
	}else{
		b = fun(n/5);
		dp[n/5] = b;
	}
	return a+b;
}
int main(){
	ll N;cin>>N;
	dp[0]=1;dp[1]=2;
	cout << fun(N) << endl;
	return 0;
}
            
            
            
        