結果
| 問題 | No.639 An Ordinary Sequence | 
| コンテスト | |
| ユーザー |  ngtkana | 
| 提出日時 | 2020-04-04 12:53:54 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 1,000 ms | 
| コード長 | 447 bytes | 
| コンパイル時間 | 2,094 ms | 
| コンパイル使用メモリ | 199,988 KB | 
| 最終ジャッジ日時 | 2025-01-09 14:01:24 | 
| ジャッジサーバーID (参考情報) | judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 17 | 
ソースコード
#include<bits/stdc++.h>
using lint=long long;
using real=long double;
std::map<lint,lint>map;
lint cal(lint x){
    if(x==0)return 1;
    if(auto it=map.find(x);it!=map.end()){
        return it->second;
    }
    return map[x]=cal(x/3)+cal(x/5);
}
int main(){
    std::cin.tie(nullptr);std::ios_base::sync_with_stdio(false);
    std::cout.setf(std::ios_base::fixed);std::cout.precision(15);
    lint n;std::cin>>n;
    std::cout<<cal(n)<<'\n';
}
            
            
            
        