我是靠谱客的博主 美好可乐,这篇文章主要介绍HDOJ 1049 水题,现在分享给大家,希望可以做个参考。

题目:http://acm.hdu.edu.cn/showproblem.php?pid=1049

复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include<bits/stdc++.h> #define INF 1e18 #define inf 1e9 #define min(a,b) a<b?a:b #define max(a,b) a>b?a:b #define lson l,m,rt<<1 #define rson m+1,r,rt<<1|1 #define IOS ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0) using namespace std ; typedef long long ll; typedef unsigned long long ull; const ll _max = 205; int main(){ IOS; int n,u,d; while(cin>>n>>u>>d){ if(!n&&!u&&!d) break; int ans = 0; while(n>0){ n-=u; ans++; if(n<=0) break; n+=d; ans++; } cout<<ans<<endl; } return 0; }

最后

以上就是美好可乐最近收集整理的关于HDOJ 1049 水题的全部内容,更多相关HDOJ内容请搜索靠谱客的其他文章。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(55)

评论列表共有 0 条评论

立即
投稿
返回
顶部