
Lazy frog
发布日期:2021-05-10 10:56:57
浏览次数:23
分类:原创文章
本文共 851 字,大约阅读时间需要 2 分钟。
Lazy frog
There was once a frog who live in the depth of the unknown wells,
one day he wanted to walk out.But he was lazy, climb three meters daytime and night will fall two meters.
If given the well depth x, you calculate the number of days after the frog from the well out.
Input
Input a series of test data. Each line including a integer x (x<=1000).
Output
Output there is an integer representing the number of days required.
Sample Input
3 2 4
Sample Output
1 1 2
#include <stdio.h>int main(void){ int h; while(scanf("%d", &h) == 1) { int m = 0, i; for(i = 0; m < h; ) { m += 3; i++; if(m >= h) { break; } else { m -= 2; } } printf("%d\n", i); }}
发表评论
最新留言
逛到本站,mark一下
[***.202.152.39]2025年04月10日 12时29分25秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
【5G之道】第一章:介绍
2021-05-14
解决Vue源码运行错误
2021-05-14
HDU - 4109 Instrction Arrangement
2021-05-14
Lua websocket长连接
2021-05-14
SQL 分页查询 返回总条数
2021-05-14
重写的特点
2021-05-14
富士电机漏洞预警
2021-05-14
【数据库】MySQL导入文件与导出文件
2021-05-14
计算机网络UDP协议和TCP协议
2021-05-14
Linux运行C语言文件
2021-05-14
C字符串高级
2021-05-14
2010-03-25 函数题
2021-05-14
C语言_动态内存分配练习
2021-05-14
Linux学习_系统进程概念
2021-05-14
七层网络模型(待添加)
2021-05-14
考研复试——KY276 Problem C
2021-05-14
LeetCode62/63/64 不同路径I/II/最小路径和
2021-05-14
LeetCode 45/55. 跳跃游戏I/II
2021-05-14
老鸟带你画tiled lines
2021-05-14
MybatisPlus自定义Sql实现多表查询
2021-05-15