YSchencheche @ 2023-10-19 20:38:14
为什么错啊
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b,c;
cin>>a>>b>>c;
bool v[9999],f=0,F;
for(int i=123;i<=987;i++)
{
int q=i*b,w=i*c;
memset(v,0,sizeof(v));
F=0;
v[q%10]=1;
v[q/10%10]=1;
v[q/100]=1;
v[w%10]=1;
v[w/10%10]=1;
v[w/100]=1;
v[i%10]=1;
v[i/10%10]=1;
v[i/100]=1;
for(int i=1;i<=9;i++)
{
if(!v[i])
{
F=1;
break;
}
}
if(!F && q<1000 && w<1000)
{
cout<<i<<" "<<q<<" "<<w<<"\n";
f=1;
}
}
if(!f)
{
cout<<"No!!!";
}
return 0;
}
QAQ
by zrl123456 @ 2023-10-20 20:14:07
来,直接看#7
123 456 789
i要从1开始循环
并且题目没有保证a=1
by zrl123456 @ 2023-10-20 20:16:16
#include<bits/stdc++.h>
using namespace std;
bool v[10],f,F;
int a,b,c;
int main(){
cin>>a>>b>>c;
for(int i=1;i<=987;i++){
int l=i*a,q=i*b,w=i*c;
memset(v,0,sizeof(v));
F=false;
v[q%10]=1;
v[q/10%10]=1;
v[q/100%10]=1;
v[w%10]=1;
v[w/10%10]=1;
v[w/100%10]=1;
v[l%10]=1;
v[l/10%10]=1;
v[l/100%10]=1;
for(int i=1;i<=9;i++){
if(!v[i]){
F=true;
break;
}
}
if(!F&&q<1000&&a<1000&&w<1000){
cout<<l<<" "<<q<<" "<<w<<endl;
f=true;
}
}
if(!f){
cout<<"No!!!";
}
return 0;
}