满分20,扣2分,5个答案正确,2个答案错误。
import java.util.ArrayList;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// write your code here
Scanner sc=new Scanner(System.in);
int m=sc.nextInt();
int x=sc.nextInt();
int y=sc.nextInt();
int a,b;
double c;
ArrayList<Double> s1=new ArrayList<Double>();
ArrayList<Double> s2=new ArrayList<Double>();
ArrayList<Double> s3=new ArrayList<Double>();
for (a=10;a<100;a++){
int s=a/10;
int g=a-s*10;
b=g*10+s;
c=(double)(Math.abs(a-b))/x;
if ((Math.abs(a-b))%c==0){
if (b==c*y){
s1.add((double)a);
s2.add((double)b);
s3.add(c);
}
}
}
double max1=s1.get(0);
double max2=0,max3=0;
for (int i=0;i<s1.size();i++){
if (max1<s1.get(i)){
max1=s1.get(i);
}
}
for (int i=0;i<s1.size();i++){
if (max1==s1.get(i)){
max2=s2.get(i);
max3=s3.get(i);
}
}
if (max1>9&&max1<100){
System.out.print((int)max1+" ");
if (m>max1){
System.out.print("Gai ");
}
if (m<max1){
System.out.print("Cong ");
}
if (m==max1){
System.out.print("Ping ");
}
if (m>max2){
System.out.print("Gai ");
}
if (m<max2){
System.out.print("Cong ");
}
if (m==max2){
System.out.print("Ping ");
}
if (m>max3){
System.out.print("Gai");
}
if (m<max3){
System.out.print("Cong");
}
if (m==max3){
System.out.print("Ping");
}
}
else{
System.out.println("No Solution");
}
}
}