_Cupid @ 2019-11-23 15:43:16
#include<stdio.h>
void sortp(int a,int b,int c);
void func(int a, int b[]);
int comp(int c[], int d[], int e[]);
int main()
{
int x[3];
int y[3];
int z[3];
int a,b,c;
int i,flag;
scanf("%d%d%d",&a,&b,&c);
for(i = 123;i < 987; i++)
{
func(i,z);
func((b/a)*i,x);
func((c/a)*i,y);
if(comp(x, y, z))
{ sortp( i, (b/a)*i, (c/a)*i);
printf("\n");
flag = 1;
}
}
if(flag==0)printf("No!!!");
return 0;
}
void func(int a, int b[])
{
b[0] = a % 10;
b[1] = (a / 10) % 10;
b[2] = a / 100;
}
int comp(int c[], int d[], int e[])
{
if(((c[0] + c[1] + c[2] + d[0] +d[1] + d[2] + e[0] + e[1] +e[2]) == 45) &&((c[0] * c[1] * c[2] * d[0] * d[1] * d[2] * e[0] * e[1] * e[2]) == 362880))
return 1;
else return 0;
}
void sortp(int a,int b,int c)
{
int t;
if(a>b) /*如果a大于b,借助中间变量t实现a与b值的互换*/
{
t = a;
a = b;
b = t;
}
if(a>c) /*如果a大于c,借助中间变景t实现a与c值的互换*/
{
t = a;
a = c;
c = t;
}
if(b>c) /*如果b大于c,借助中间变量t实现b与c值的互换*/
{
t = b;
b = c;
c = t;
}
printf("%d %d %d",a,b,c);
}
为啥只有80分?萌新求助!!
by 卑微求help @ 2019-11-23 16:12:43
@_Cupid (c/a)i和(b/a)i万一是小数不是整数呢
by _Cupid @ 2019-11-23 17:08:01
哇!AC了,谢谢大佬!!
by _Cupid @ 2019-11-23 17:08:15
@卑微求help