用for来解题(范围限定自己理解)
2024-04-14 21:28:45
发布于:上海
32阅读
0回复
0点赞
#include<iostream>
using namespace std;
int main(){
for (int i=123; i<334; i++){
if (i%5==0) continue;
if (i<200&&i>195||i<300&&i>295) continue;
if (i<215&&i>200||i<315&&i>300) continue;
int a1=i*1,a2=i*2,a3=i*3;
if (a1/10%10==0||a2/10%10==0||a3/10%10==0) continue;
if (a1/100!=a1/10%10&&a1/10%10!=a1%10&&a1%10!=a1/100){
if (a2/100!=a2/10%10&&a2/10%10!=a2%10&&a2%10!=a2/100){
if (a3/100!=a3/10%10&&a3/10%10!=a3%10&&a3%10!=a3/100){
if (a1/100!=a2/10%10&&a2/10%10!=a3%10&&a3%10!=a1/100){
if (a2/100!=a3/10%10&&a3/10%10!=a1%10&&a1%10!=a2/100){
if (a3/100!=a1/10%10&&a1/10%10!=a2%10&&a2%10!=a3/100){
if (a1/100!=a3/10%10&&a3/10%10!=a2%10&&a2%10!=a1/100){
if (a2/100!=a1/10%10&&a1/10%10!=a3%10&&a3%10!=a2/100){
if (a3/100!=a2/10%10&&a2/10%10!=a1%10&&a1%10!=a3/100){
cout << a1 << " " << a2 << " " << a3 << endl;
}
}
}
}
}
}
}
}
}
}
return 0;
}
全部评论 1
#include<iostream>
using namespace std;
int main(){
for (int i=123; i<334; i++){
if (i%5==0) continue;
if (i<200&&i>195||i<300&&i>295) continue;
if (i<215&&i>200||i<315&&i>2023-11-22 来自 上海
0
有帮助,赞一个