-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path1088.c
51 lines (50 loc) · 1.07 KB
/
1088.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
int me,x,y;
scanf("%d%d%d",&me,&x,&y);
int a,b = 0,flag=0;
for(a=9;a>=1;a--){
for(b=9;b>=0;b--){
if(((double)abs(a*10+b-b*10-a)/(double)x==(double)(b*10+a)/(double)y)){
flag=1;
break;
}
}
if(flag){
break;
}
}
if(flag){
int jia=a*10+b,yi=b*10+a;
double ding=(double)yi/(double)y;
int arr[4]={jia,yi};
printf("%d",jia);
for(int i=0;i<2;i++){
if(arr[i]>me){
printf(" Cong");
}
else if(arr[i]==me){
printf(" Ping");
}
else{
printf(" Gai");
}
}
if(ding>me){
printf(" Cong");
}
else if(ding==me){
printf(" Ping");
}
else{
printf(" Gai");
}
printf("\n");
}
else{
printf("No Solution\n");
}
return 0;
}