https://pintia.cn/problem-sets/994805260223102976/problems/1038429286185074688
测试4是把丙的得分值的数据类型改为double。
#include<iostream>
#include<math.h>
using namespace std;
string cmp(int m, double n){
if(m==n){
return " Ping";
}else if(m>n){
return " Gai";
}else{
return " Cong";
}
}
int main() {
int m, x, y, flag=0;
double a, b, c;
cin >> m >> x >> y;
for(a=99; a>=10; a--){
b = 0;
for(int t=a; t>0; t/=10){
b = b*10 + t%10;
}
c = abs(a-b)/x;
if(c*y==b){
flag = 1;
break;
}
}
if(flag == 1){
cout << a << cmp(m, a) << cmp(m, b) << cmp(m, c) << endl;
}else{
cout << "No Solution" << endl;
}
return 0;
}