码迷,mamicode.com
首页 > 其他好文 > 详细

循环-09. 支票面额

时间:2014-07-28 21:23:14      阅读:228      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   color   os   strong   io   2014   

 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\n", y, f);
21                 return 0;
22             }
23         }
24     }
25     printf("No Solution\n");
26 
27     return 0;
28 }

题目链接:

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

 

循环-09. 支票面额,布布扣,bubuko.com

循环-09. 支票面额

标签:style   blog   http   color   os   strong   io   2014   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!