HDU 1555 How many days?
来源:互联网 发布:solidworks有mac版吗 编辑:程序博客网 时间:2024/05/16 16:07
http://acm.hdu.edu.cn/showproblem.php?pid=1555
How many days?
TimeLimit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K(Java/Others)Total Submission(s): 2783 Accepted Submission(s):1649
Problem Description
8600的手机每天消费1元,每消费K元就可以获赠1元,一开始8600有M元,问最多可以用多少天?
Input
输入包括多个测试实例.每个测试实例包括2个整数M, k,(2<= k <= M <= 1000).M =0, k = 0代表输入结束.
Output
对于每个测试实例输出一个整数,表示M元可以用的天数。
Sample Input
2 2 4 3 00
Sample Output
3 5
Author
8600
Source
HDU 2006-12 Programming Contest
Recommend
LL
分析:算是递推吧。。
代码如下:
#include<stdio.h>
int main()
{
int m,k,count;
int days;
while(scanf("%d%d",&m,&k),m,k)
{
count=days=0;
while(m)
{
m--;
count++;
days++;
if(count==k)
{
count=0;
m++;
}
}
printf("%d\n",days);
}
return 0;
}
int main()
{
}
阅读全文
0 0
- HDU 1555 How many days?
- HDU How many prime numbers
- (HDU)1213 How Many Tables
- POJ 2413 How many Fibs?
- HDOJ 1316 How Many Fibs?
- HDU 2577 How to Type (DP)
- HDU 1242 Rescue
-  
- hdu 2577 How to Type //简单DP
- many demos in cv
-
- How to install OsmocomBB
- How to Debug Perl
- EBS: How to clone?
- ZZULI_SummerPractice(3) HDU 1…
- HDU 1579 Function Run Fun
- HDU 1405 The Last Practice
- HDU 2050 折线分割平面
- HDU 1799 循环多少次?
- web项目部署到Tomcat上使用
- HDU 1785 You Are All Excellent
- HDU 1718 Rank
- HDU 1708 Fibonacci String
- HDU 1555 How many days?
- ffmpeg ndk
- HDU 1491 Octorber 21st
- 从 Centos 安装到TensorFlow的安装
- HDU 1405 The Last Practice
- HDU 1397 Goldbach's Conjecture
- HDU 1391 Number Steps
- 比较两个String类型日期大小
- HDU 1339 A Simple Task