#include<iostream>
#include<cstring>
#include<algorithm>
using namespace std;
typedef long long ll;
#define maxn 20
int N;
int A[maxn]={1,2,3,4,5,6,7,8,9};
ll ans=0,a,b,c;
ll getNum(int x,int y){
ll tmp=0;
ll p=1;
for(int i=x;i<=y;i++){
tmp+=A[i]*p;
p*=10;
}
return tmp;
}
int main(){
cin>>N;
do{
//先确定A的位数
for(int i=0;i<=6;i++){
a=getNum(0,i);
if(a>N) break;
for(int j=i+1;j<8;j++){
b=getNum(i+1,j);
c=getNum(j+1,8);
if((N-a)*c==b) ans++;
}
}
}while(next_permutation(A,A+9));
cout<<ans<<endl;
return 0;
}
2018NJUPT 第三场排位赛 小B的排列(全排列)
猜你喜欢
转载自blog.csdn.net/qq_37360631/article/details/81582770
今日推荐
周排行