【Codeforces Round #421 (Div. 2) A】Mister B and Book Reading
【题目链接】:http://codeforces.com/contest/820/problem/A
【题意】
每天看书能看v页;
且这个v每天能增加a;
但是v有上限v1;
然后每天还必须往回看t页;
问你最少多少天能看完;
一共有c页;
【题解】
傻逼题.
【Number Of WA】
1
【反思】
在处理超过v1的时候没搞好.
【完整代码】
#include <bits/stdc++.h>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
#define LL long long
#define rep1(i,a,b) for (int i = a;i <= b;i++)
#define rep2(i,a,b) for (int i = a;i >= b;i--)
#define mp make_pair
#define pb push_back
#define fi first
#define se second
#define ms(x,y) memset(x,y,sizeof x)
#define Open() freopen("F:\\rush.txt","r",stdin)
#define Close() ios::sync_with_stdio(0)
typedef pair<int,int> pii;
typedef pair<LL,LL> pll;
const int dx[9] = {0,1,-1,0,0,-1,-1,1,1};
const int dy[9] = {0,0,0,-1,1,-1,1,-1,1};
const double pi = acos(-1.0);
const int N = 110;
LL c,v0,v1,a,l;
void dfs(LL x,LL v,LL day){
if (x >= c){
cout << day << endl;
return;
}
x-=l;
LL temp = min(v1,v + a);
dfs(x + temp,temp,day+1);
}
int main(){
//Open();
Close();
cin >> c >> v0 >> v1 >> a >> l;
dfs(v0,v0,1);
return 0;
}
【Codeforces Round #421 (Div. 2) A】Mister B and Book Reading的更多相关文章
- 【Codeforces Round #421 (Div. 2) B】Mister B and Angle in Polygon
[题目链接]:http://codeforces.com/contest/820/problem/B [题意] 给你一个正n边形; 然后让你在这正n边行中选3个点,组成一个角; 找出角的大小和所给的角 ...
- 【Codeforces Round #432 (Div. 1) B】Arpa and a list of numbers
[链接]h在这里写链接 [题意] 定义bad list是一个非空的.最大公约数为1的序列.给定一个序列,有两种操作:花费x将一个元素删除.花费y将一个元素加1,问你将这个序列变为good list所需 ...
- 【Codeforces Round #420 (Div. 2) C】Okabe and Boxes
[题目链接]:http://codeforces.com/contest/821/problem/C [题意] 给你2*n个操作; 包括把1..n中的某一个数压入栈顶,以及把栈顶元素弹出; 保证压入和 ...
- 【Codeforces Round #420 (Div. 2) B】Okabe and Banana Trees
[题目链接]:http://codeforces.com/contest/821/problem/B [题意] 当(x,y)这个坐标中,x和y都为整数的时候; 这个坐标上会有x+y根香蕉; 然后给你一 ...
- 【Codeforces Round #420 (Div. 2) A】Okabe and Future Gadget Laboratory
[题目链接]:http://codeforces.com/contest/821/problem/A [题意] 给你一个n*n的数组; 然后问你,是不是每个位置(x,y); 都能找到一个同一行的元素q ...
- 【Codeforces Round #423 (Div. 2) C】String Reconstruction
[Link]:http://codeforces.com/contest/828/problem/C [Description] 让你猜一个字符串原来是什么; 你知道这个字符串的n个子串; 且知道第i ...
- 【Codeforces Round #423 (Div. 2) B】Black Square
[Link]:http://codeforces.com/contest/828/problem/B [Description] 给你一个n*m的格子; 里面包含B和W两种颜色的格子; 让你在这个格子 ...
- 【Codeforces Round #423 (Div. 2) A】Restaurant Tables
[Link]:http://codeforces.com/contest/828/problem/A [Description] 有n个组按照时间顺序来餐馆; 每个组由一个人或两个人组成; 每当有一个 ...
- 【Codeforces Round #422 (Div. 2) D】My pretty girl Noora
[题目链接]:http://codeforces.com/contest/822/problem/D [题意] 有n个人参加选美比赛; 要求把这n个人分成若干个相同大小的组; 每个组内的人数是相同的; ...
随机推荐
- class-metaclass-Class vs. type
In some languages, classes are only a compile-time feature (new classes cannot be declared at runtim ...
- 紫书 习题 8-24 UVa 10366 (构造法)
又是一道非常复杂的构造法-- #include<cstdio> #include<algorithm> #define REP(i, a, b) for(int i = (a) ...
- 错误解决:error: expected ‘;’, ‘,’ or ‘)’ before ‘&’ token
今天看到一个比较有趣的题目,如下代码,分析输出结果 #include <stdio.h> void num(int &b) { b = 222; return; } int mai ...
- chrome默认打开隐身模式
chrome图标右键属性,在“目标”后添加参数“ --incognito”(注意是双短划线,不包括双引号,双短划线前加一空格)就可以直接以隐身模式启动chrome了
- 数学之路-python计算实战(18)-机器视觉-滤波去噪(双边滤波与高斯滤波 )
高斯滤波就是对整幅图像进行加权平均的过程.每个像素点的值,都由其本身和邻域内的其它像素值经过加权平均后得到.高斯滤波的详细操作是:用一个模板(或称卷积.掩模)扫描图像中的每个像素.用模板确定的邻域内像 ...
- CSS中的相关概念
CSS的几个概念: 包括块:一个元素的"布局上下文".对于正常的HTML文本流中的一个元素,包括块由近期的块级祖先框.表单元格或行内块祖先框的内容边界(content edge)构 ...
- Python库之pyudev (一)
库pyudev是libudev的python封装,libudev提拱了对本地设备的列举与查询API. 1.安装 pip install pyudev 2. 使用 2.1 开始 导入pyudev,验证库 ...
- IIS访问站点,出现connection refused
排查后,发现是因为使用了代理导致的. 需要设置 Don't use the proxy server for local addresses.
- hdoj--1556--Color the ball(模拟&&树状数组)
Color the ball Time Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) T ...
- Gcc/MinGW/Cygwin/Msys 分别是什么?
一.GCC的历史 GCC是一个原本用于Unix-like系统下编程的编译器. 不过,现在GCC也有了许多Win32下的移植版本. 所以,也许对于许多Windows开发者来说,GCC还是一个比较陌生的东 ...