結果
| 問題 |
No.639 An Ordinary Sequence
|
| コンテスト | |
| ユーザー |
newlife171128
|
| 提出日時 | 2018-01-31 00:10:08 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 1,000 ms |
| コード長 | 689 bytes |
| コンパイル時間 | 1,563 ms |
| コンパイル使用メモリ | 161,456 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2025-01-02 02:18:22 |
| 合計ジャッジ時間 | 2,472 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 17 |
ソースコード
#include <bits/stdc++.h>
#include "bits/stdc++.h"
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <string>
#include <sstream>
#include <cmath>
#include <stack>
#include <queue>
#include <cctype>
#include <stdio.h>
#include <map>
#include <string.h>
#include <utility>
typedef long long ll;
#define INF (1e9+1)
#define rep(i,n) for(ll i=0;i<(ll)(n);i++)
using namespace std;
typedef pair<int, int> P;
map<ll,int> mp;
ll dfs(ll a){
ll ans =0;
if(a ==0){
return 1;
}
if(mp[a] !=0){
return mp[a];
}
ans +=dfs(a/3);
mp[a] =ans;
ans +=dfs(a/5);
mp[a] =ans;
return ans;
}
int main() {
ll n=0;
cin>>n;
cout<<dfs(n)<<endl;
}
newlife171128