結果

問題 No.639 An Ordinary Sequence
ユーザー
提出日時 2020-11-19 11:37:52
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 587 bytes
コンパイル時間 1,509 ms
コンパイル使用メモリ 99,800 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-23 10:01:02
合計ジャッジ時間 1,584 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
map<long long, long long> m;
long long r(long long x) {
	if (x == 0) {
		return 1;
	}
	else if (m.count(x)) {
		return m[x];
	}
	else {
		return m[x] = r(x / 3) + r(x / 5);
	}
}
int main() {
	long long n;
	cin >> n;
	cout << r(n) << endl;
}
0