結果

問題 No.473 和と積の和
ユーザー chocorusk
提出日時 2018-09-22 12:55:15
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
TLE  
実行時間 -
コード長 792 bytes
コンパイル時間 588 ms
コンパイル使用メモリ 81,172 KB
実行使用メモリ 13,760 KB
最終ジャッジ日時 2024-07-18 08:55:11
合計ジャッジ時間 6,075 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21 TLE * 1 -- * 21
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;

int n;
vector<ll> dv;
int ans;
ll x;
int nuo;
vector<ll> p;
ll pr;

void solve(int i){
	if(i==n-1){
		if(x%pr==0 && p.back()<=x/pr) ans++;
		return;
	}
	for(int j=nuo; j<dv.size(); j++){
		if(pr*dv[j]>x) break;
		if((x/pr)%dv[j]!=0) continue;
		p.push_back(dv[j]);
		pr*=dv[j];
      nuo=j;
		solve(i+1);
		pr/=dv[j];
		p.pop_back();
	}
}

int main()
{
	cin>>n>>x;
	x++;
	pr=1;
	for(ll i=1; i*i<=x; i++){
		if(x%i!=0) continue;
		dv.push_back(i);
	}
	pr=1; nuo=1;
	solve(0);
	cout<<ans<<endl;
	return 0;
}
0