你没输入????
by luogu2010ly @ 2024-02-03 21:04:04
抱歉,看错了...........
by luogu2010ly @ 2024-02-03 21:08:36
你的判断语句有问题?
int a,b,c;
for(a = 123;a<=333;a++)
{
b=a*2;
c=a*3;
if((a/100+a/10%10+a%10+b/100+b/10%10+b%10+c/100+c/10%10+c%10==1+2+3+4+5+6+7+8+9)&&((a/100)*(a/10%10)*(a%10)*(b/100)*(b/10%10)*(b%10)*(c/100)*(c/10%10)*(c%10)==(1)*(2)*(3)*(4)*(5)*(6)*(7)*(8)*(9)))
{
cout << a <<" "<< b <<" "<< c <<endl;
}
}
这样就可以了
by luogu2010ly @ 2024-02-03 21:17:39
b=a2是b=a*2
c=a3是c=a*3
by luogu2010ly @ 2024-02-03 21:19:04
@[ovoPolar_bear](/user/681821)
本蒟蒻在做完升级版后发现了这道题
_~~**所以直接拿升级版的来做**~~_
不过ABC的变量要改一下
```cpp
#include<bits/stdc++.h>
using namespace std;
int A = 1,B = 2,C = 3;
int cnt[10];
bool check(int x){
if(A == 0) return false;
if(x * B % A != 0)
return false;
int y = x * B / A;
if(C * y % B != 0)
return false;
int z = C * y / B;/*判断x:y:z 是否等于A:B:C*/
if(y < 100 || y > 999) return false;
if(z < 100 || z > 999) return false;
memset(cnt,0,sizeof(cnt));/*清空*/
int x_ = x, y_ = y, z_ = z;/*备份*/
for(int i = 1;i <= 3;i++){
cnt[x % 10] ++; x /= 10;
cnt[y % 10] ++; y /= 10;
cnt[z % 10] ++; z /= 10;
}
for(int i = 1;i < 10;i++)
if(cnt[i] != 1)
return false;
cout << x_ << ' ' << y_ << ' ' << z_ << endl;
return true;
}
int main(){
int o = 0;
for(int x = 123;x <= 987;x++){
if(check(x))
o++;
}
if(o == 0){
cout << "No!!!";
}
return 0;
}
```
by Dark_Monarch @ 2024-02-05 15:33:48
@[ovoPolar_bear](/user/681821)
```c
#include<iostream>
using namespace std;
int n[9]={0,0,0,0,0,0,0,0,0};
int sum=0;
bool notSame(int a,int b,int c){
sum=0;
n[0]=a/100;n[1]=a/10%10;n[2]=a%10;
n[3]=b/100;n[4]=b/10%10;n[5]=b%10;
n[6]=c/100;n[7]=c/10%10;n[8]=c%10;
for(int i=0;i<9;i++)for(int j=0;j<9;j++)if(n[i]==n[j]&&i!=j||n[i]==0)return false;
return true;
}
int main()
{
int a,b,c;
for(a=100;a<=333;a++){
b=2*a;c=a*3;
if(notSame(a,b,c))cout<<a<<" "<<b<<" "<<c<<" "<<endl;
}
return 0;
}
```
by Charlie509 @ 2024-04-20 16:05:49