枚举即可
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int s[14]={0};
int main()
{
ll n;
scanf("%lld",&n);
for(int i=1;i<=9;i++)s[i]=i;
ll ans=0;
do
{
ll a=0,b=0,c=0;
for(int i=1;i<=7;i++)
{
a=a*10+s[i];
for(int j=i+1;j<=8;j++)
{
b=b*10+s[j];
for(int l=j+1;l<=9;l++)
{
c=c*10+s[l];
}
if(a*c+b==c*n)ans++;
c=0;
}
b=0;
}
}while(next_permutation(s+1,s+10));
printf("%d\n",ans);
return 0;
}
标签:P8599,int,ll,long,带分数,蓝桥,2013
From: https://www.cnblogs.com/pure4knowledge/p/17863050.html