pat乙级1088
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
struct Node
{
int x;
int y;
double z;
};
bool cmp(Node a, Node b)
{
return a.x > b.x;
}
int main()
{
int m, jia, yi, x, y;
double bing;
cin >> m >> x >> y;
vector<Node> v;
for (jia = 10; jia < 99; jia++)
{
yi = jia%10*10+jia/10;
bing =(double)yi / y;
if (abs(jia - yi) == bing*x)
v.push_back(Node{ jia,yi,bing });
}
sort(v.begin(), v.end(), cmp);
if (v.size())
{
cout << v[0].x;
if (v[0].x > m)
cout << " " << "Cong";
else if (v[0].x == m)
cout << " " << "Ping";
else
cout << " " << "Gai";
if (v[0].y > m)
cout << " " << "Cong";
else if (v[0].y == m)
cout << " " << "Ping";
else
cout << " " << "Gai";
if (v[0].z > m)
cout << " " << "Cong";
else if (v[0].z == m)
cout << " " << "Ping";
else
cout << " " << "Gai";
}
else
cout << "No Solution";
return 0;
}