結果
| 問題 |
No.473 和と積の和
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-12-15 17:33:55 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,579 bytes |
| コンパイル時間 | 1,052 ms |
| コンパイル使用メモリ | 94,032 KB |
| 実行使用メモリ | 6,824 KB |
| 最終ジャッジ日時 | 2024-12-16 02:24:45 |
| 合計ジャッジ時間 | 2,892 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 40 WA * 3 |
ソースコード
#include <iostream>
#include <iomanip>
#include <vector>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cmath>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <sstream>
#include <string>
#include <cassert>
#define _repargs(_1,_2,_3,name,...) name
#define _rep(i,n) repi(i,0,n)
#define repi(i,a,b) for(int i=(int)(a);i<(int)(b);++i)
#define rep(...) _repargs(__VA_ARGS__,repi,_rep,)(__VA_ARGS__)
#define all(x) (x).begin(),(x).end()
#define mod 1000000007
#define inf 2000000007
#define mp make_pair
#define pb push_back
typedef long long ll;
using namespace std;
template <typename T>
inline void output(T a, int p = 0) {
if(p) cout << fixed << setprecision(p) << a << "\n";
else cout << a << "\n";
}
// end of template
// nをm以上のk個の約数で分解する方法
ll dec(ll n, ll m, int k){
if(k == 0){
if(n == 1) return 1;
else return 0;
}
if(k == 1){
if(n >= m) return 1;
else return 0;
}
if(pow(n, 1.0 / k) < m) return 0;
ll ret = 0;
for(ll d = m; d * d <= n; d++){
if(n % d == 0){
ll nn = n;
int cnt = 1;
while(nn % d == 0 && k >= cnt){
nn /= d;
ret += dec(nn, d + 1, k - cnt);
cnt++;
}
}
}
return ret;
}
int main() {
cin.tie(0);
ios::sync_with_stdio(0);
// source code
int N;
ll X;
cin >> N >> X;
ll M = dec(X + 1, 2, N);
assert(M <= 200000);
output(M);
return 0;
}