Voryunmo @ 2019-07-16 16:01:07
#include<stdio.h>
int main()
{
int i,j,k,a[10]={0},x,y,z,t=0;
scanf("%d%d%d",&x,&y,&z);
for(i=1;i<987;i++)
{
if(x*i<=987)
{
a[x*i%10]++;
a[x*i/10%10]++;
a[x*i/100]++;
}
if(y*i<=987)
{
a[y*i%10]++;
a[y*i/10%10]++;
a[y*i/100]++;
}
if(z*i<=987)
{
a[z*i%10]++;
a[z*i/10%10]++;
a[z*i/100]++;
}
for(j=1;j<=9;j++)
if(a[j]==0)
break;
if(j>=10)
{
printf("%d %d %d\n",x*i,y*i,z*i);
t=1;
}
for(j=1;j<=9;j++)
a[j]=0;
}
if(t==0)printf("No!!!");
return 0;
}
by Voryunmo @ 2019-07-16 16:02:01
向大佬求救
by pidan @ 2019-07-16 16:08:49
#include<bits/stdc++.h>
using namespace std;
int main(){
double a,b,c,o=0;
cin>>a>>b>>c;
for(int A=123;A<=999;A++)
{
int B=b/a*A,C=c/a*A,q=A/100,w=A/10-A/100*10,e=A%10,r=B/100,t=B/10-B/100*10,y=B%10,u=C/100,i=C/10-C/100*10,p=C%10;
if((A/100)*(A/10-A/100*10)*(A%10)*(B/100)*(B/10-B/100*10)*(B%10)*(C/100)*(C/10-C/100*10)*(C%10)==1*2*3*4*5*6*7*8*9&&q!=w&&q!=e&&q!=r&&q!=t&&q!=y&&q!=u&&q!=i&&q!=p&&w!=e&&w!=r&&w!=t&&w!=y&&w!=u&&w!=i&&w!=p&&e!=r&&e!=t&&e!=y&&e!=u&&e!=i&&e!=p&&r!=t&&r!=y&&r!=u&&r!=i&&r!=p&&t!=y&&t!=u&&t!=i&&t!=p&&y!=u&&y!=i&&y!=p&&u!=i&&u!=p&&i!=p){
o=1;
cout<<A<<" "<<B<<" "<<C<<endl;
}
}
if(o==0) cout<<"No!!!";
return 0;
}
暴力出奇迹
by royzhu @ 2019-07-16 16:10:06
当j等于10时才跳出循环
by royzhu @ 2019-07-16 16:10:49
j不会大于10
by royzhu @ 2019-07-16 16:11:00
@Voryunmo
by Voryunmo @ 2019-07-16 16:22:52
好的谢谢谢谢谢谢@royzhu
by Boeing737_MAX_8 @ 2019-07-16 16:28:28
@Voryunmo 你在干哈啊for不加if的
by Boeing737_MAX_8 @ 2019-07-16 16:29:00
@Voryunmo (不加括号)打错了,而且差别有些大【手动滑稽
by Boeing737_MAX_8 @ 2019-07-16 16:29:39
for(j=1;j<=9;j++)
if(a[j]==0)
break;
if(j>=10)
{
printf("%d %d %d\n",x*i,y*i,z*i);
t=1;
}
for(j=1;j<=9;j++)
a[j]=0;
你说那个j>=10在外头那for里吗
by Boeing737_MAX_8 @ 2019-07-16 16:31:11
@Voryunmo 从上面那个for出来过后j肯定等于十,你j<=9是for的运行条件,那么最后一次运行过后,j会被加一,然后不符合条件不会进行下一次循环