#include<iostream>
#include<cstdio>
#include<algorithm>
using namespace std;
int ans[9]={1,2,3,4,5,6,7,8,9};//把所有排列弄出来
int Count=0;
int main()
{
int n;
scanf("%d",&n);
do{
for(int i=0;i<=6;i++)
{
for(int j=i+1;j<=7;j++){
int node=0,a=0,b=0,c=0;
//设置两个断点 将排列分为三段,然后再比较等式
while(node<=i){
a=a*10+ans[node++];
}
while(node<=j){
b=b*10+ans[node++];
}
while(node<=8){
c=c*10+ans[node++];
}
if(a*c+b==n*c)Count++;//这里只需比较一种就行,不需要排列六种
}
}
}while(next_permutation(ans,ans+9));
printf("%d",Count);
return 0;
}
13蓝桥杯 带分数
最新推荐文章于 2018-10-06 07:36:48 发布