题目:https://pintia.cn/problem-sets/994805260223102976/problems/1038429286185074688

这道题太坑了,搞了我快一个小时。。
丙有可能是小数

代码

  1. #include<cstdio>
  2. #include<algorithm>
  3. using namespace std;
  4. int m, x, y;
  5. void show(double unknown){
  6. if(m < unknown) printf(" Cong");
  7. if(m == unknown) printf(" Ping");
  8. if(m > unknown) printf(" Gai");
  9. }
  10. int main(){
  11. scanf("%d%d%d", &m, &x, &y);
  12. for(int i = 99; i >= 10; i--){
  13. int j = i % 10 * 10 + i / 10;
  14. double c = abs(i - j) * 1.0 / x ;
  15. if (j == y * c){
  16. printf("%d", i);
  17. show(i);
  18. show(j);
  19. show(c);
  20. return 0;
  21. }
  22. }
  23. printf("No Solution");
  24. return 0;
  25. }