結果
| 問題 |
No.639 An Ordinary Sequence
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2018-12-09 07:26:31 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 365 bytes |
| コンパイル時間 | 1,838 ms |
| コンパイル使用メモリ | 166,688 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-01-02 02:38:18 |
| 合計ジャッジ時間 | 3,023 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
map<long long, long long> mp;
long long calc(long long x) {
if(x == 0) {
return 1;
}
if(mp.count(x)) {
return mp[x];
}
return mp[x] = calc(x / 3) + calc(x / 5);
}
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
long long n;
cin >> n;
cout << calc(n) << endl;
return 0;
}