双重题解
2024-01-26 15:05:37
发布于:广东
76阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int main(){
//a方法
//cout << "192 384 576\n" ;
//cout << "219 438 657\n" ;
//cout << "273 546 819\n" ;
//cout << "327 654 981\n";
//b方法
for(int a=123;a<=987/3;a++){
int b=a*2,c=a*3;
int abc=a*1000000+b*1000+c;
char s[10];
sprintf(s,"%d",abc);
sort(s, s+9);
if( atoi(s) == 123456789)
cout << a << " " << b << " " <<c << endl;
}
return 0;
}
全部评论 6
#include <bits/stdc++.h>
using namespace std;
int main(){
for(int p=1;p<=9;p++){
long long po,op,oo;
for(int b=1;b<=9;b++){
for(int c=1;c<=9;c++){
for(int d=1;d<=9;d++){
po=b100+c10+d;
}
}
}
for(int i=1;i<=9;i++){
for(int j=1;j<=9;j++){
for(int a=1;a<=9;a++){
op=i100+j10+a;
}
}
}
for(int o=1;o<=9;o++){
for(int uy=1;uy<=9;uy++){
for(int dt=1;dt<=9;dt++){
oo=o100+uy10+dt;
}
}
}
if(op/po3 && op%po0 && oo/op3 && oo%op0){
cout<<po<<" "<<op<<" "<<oo<<endl;
}
op=0;
po=0;
oo=0;
}
return 0;
}
为啥错了1周前 来自 四川
06666666
2024-01-26 来自 广东
0666666666666666666666666
2024-01-26 来自 广东
06
2024-01-26 来自 广东
0666666666
2024-01-26 来自 广东
066666666
2024-01-26 来自 广东
0
有帮助,赞一个