循环-09. 支票面额

 1 /*
 2  * Main.c
 3  * C9-循环-09. 支票面额
 4  *  Created on: 2014年7月28日
 5  *      Author: Boomkeeper
 6  ********测试通过**********
 7  */
 8 
 9 #include<stdio.h>
10 
11 int main(void) {
12     int n = 0;
13     int y, f;
14 
15     scanf("%d", &n);
16 
17     for (f = 0; f < 100; f++) {
18         for (y = 0; y <= (98 * f - n) / 199; y++) {
19             if (98 * f - 199 * y == n) {
20                 printf("%d.%d
", y, f);
21                 return 0;
22             }
23         }
24     }
25     printf("No Solution
");
26 
27     return 0;
28 }

题目链接:

http://pat.zju.edu.cn/contests/basic-programming/%E5%BE%AA%E7%8E%AF-09

原文地址:https://www.cnblogs.com/boomkeeper/p/C9.html