結果

問題 No.639 An Ordinary Sequence
ユーザー hogeover30
提出日時 2018-02-28 05:46:27
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 1,000 ms
コード長 274 bytes
コンパイル時間 2,140 ms
コンパイル使用メモリ 198,612 KB
最終ジャッジ日時 2025-01-05 08:50:40
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:5:11: warning: use of ‘auto’ in parameter declaration only available with ‘-std=c++20’ or ‘-fconcepts’
    5 | auto func(auto n)
      |           ^~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

map<long, long> memo;
auto func(auto n)
{
    if (n==0) return 1L;
    if (memo.count(n)) return memo[n];
    auto& res=memo[n];
    return res=func(n/3)+func(n/5);
}

int main()
{
    long n; cin>>n;
    cout<<func(n)<<endl;
}
0