#include
using namespace std;//n=a+b/c::n*c=a*c+b
int main()
{
// 请在此输入您的代码
string s="123456789";
int a,b,c;
int nums=0;
int n;
cin>>n;
do{//a=1,12,123.... b=2345678,234567,23456,2345....c=9,8,7
for(int i=1;i<9&&a<=n;i++){
a=atoi(s.substr(0,i));
for(int j=7;j>=0;j--){
b=atoi(s.substr(i,j));
c=atoi(s.substr(j+1));
if(n*c==a*c+b)nums++;
}
}
}while (next_permutation(s.begin(),s.end())!=0);
cout<return 0;
}
不知道你这个问题是否已经解决, 如果还没有解决的话:这好像是一个著名数学题的求解。代码很规范,注释值得推荐给其他程序员学习。系统可能想把代码加到底层库中,于是启用了挑剔标准(19:38)操作。等着吧,虽然没有错误,但是运行完成的结果也有可能是失败。god bless you, be happy!