Codeforces Round #421 (Div. 2) - A
题目链接:http://codeforces.com/contest/820/problem/A
题意:一个人在看一本书,书一共C页,这个人每天看v0页,但是他又开始加速看这本书,每天都比前一天多看a页(就是说第一天看v0页,第二天看v0+a页,第三天看v0+2*a页。。。),还有一个限制一天不能看超过v1页。 然后在第二天开始每天都会回顾之前看过的l页,问你看完整本书要多少天
思路:直接按照题意模拟即可。
#define _CRT_SECURE_NO_DEPRECATE
#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<string>
#include<map>
#include<vector>
#include<time.h>
#include<stack>
#include<cmath>
using namespace std;
typedef long long int LL;
typedef unsigned long long int ULL;
const int MAXN = + ;
int main(){
//#ifdef kirito
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
//#endif
// int start = clock();
int c,v0,v1,a,l;
while (~scanf("%d%d%d%d%d", &c,&v0,&v1,&a,&l)){
for (int i = ,k=;; i++){
if (i > ){
k -= l;
}
k += min(v1, v0 + (i - )*a);
if (k >= c){
printf("%d\n", i);
break;
}
}
}
//#ifdef LOCAL_TIME
// cout << "[Finished in " << clock() - start << " ms]" << endl;
//#endif
return ;
}
Codeforces Round #421 (Div. 2) - A的更多相关文章
- Codeforces Round #421 (Div. 2) D. Mister B and PR Shifts
Codeforces Round #421 (Div. 2) D. Mister B and PR Shifts 题意:给一个长度为\(n\)的排列,每次可以向右循环移位一次,计算\(\sum_{i= ...
- 【Codeforces Round #421 (Div. 2) B】Mister B and Angle in Polygon
[题目链接]:http://codeforces.com/contest/820/problem/B [题意] 给你一个正n边形; 然后让你在这正n边行中选3个点,组成一个角; 找出角的大小和所给的角 ...
- 【Codeforces Round #421 (Div. 2) A】Mister B and Book Reading
[题目链接]:http://codeforces.com/contest/820/problem/A [题意] 每天看书能看v页; 且这个v每天能增加a; 但是v有上限v1; 然后每天还必须往回看t页 ...
- Codeforces Round #421 (Div. 2) - B
题目链接:http://codeforces.com/contest/820/problem/B 题意:给定一个正n边形,然后让你选择3个不同的顶点,使得这3个顶点形成的角度尽可能的接近a. 思路:首 ...
- Codeforces Round #421 (Div. 2)
A: 题意:给你一本书共c页,第一天看v0页,第二天看v0+a,第二天看v0+2a以此类推,每天最多看v1页,但是后一天要重复看前一天的后l页. 代码: #include<stdio.h> ...
- Codeforces Round #421 (Div. 2)D - Mister B and PR Shifts(模拟)
传送门 题意 给出n个数,计算在进行n-1次右移中\(min\sum_{i=1}^nabs(p_i-i)\) 分析 我们设置cnt[p[i]-i]为一个数p[i]与它标准位置(如1的标准位置为1)的左 ...
- Codeforces Round #421 (Div. 2)B. Mister B and Angle in Polygon(模拟+精度控制)
传送门 题意 给出正n多边形和一个数a,寻找与a最接近的角,输出角编号 分析 找出多边形上所有角,一一比对即可 trick 1.判断的时候注意精度,i.e.x-eps>0 2.double与do ...
- Codeforces Round #421 (Div. 1) (BC)
1. 819B Mister B and PR Shifts 大意: 给定排列$p$, 定义排列$p$的特征值为$\sum |p_i-i|$, 可以循环右移任意位, 求最小特征值和对应移动次数. 右移 ...
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
随机推荐
- CG-CTF | I wanna play CTF
这题跟bugku上的come_game超级像,于是菜狗决定研究一下,先鸣谢一下好友the fool,菜狗一直卡在开始界面哇,谢谢大佬给的第一关的数据 这是过到关卡1的数据,经过一系列的尝试得到结论: ...
- 170815-关于Session知识点
Cookie:实际上就是一个头. 服务器会创建Cookie,并且将Cookie以一个响应头的形式发送给浏览器 浏览器收到Cookie以后,会保存 ...
- 大数据笔记(七)——Mapreduce程序的开发
一.分析Mapreduce程序开发的流程 1.图示过程 输入:HDFS文件 /input/data.txt Mapper阶段: K1:数据偏移量(以单词记)V1:行数据 K2:单词 V2:记一次数 ...
- gsxt滑动验证码
最后,谈谈滑动验证码. 目前,工商网站已经全面改版,全部采用了滑动验证码,上面绝大多数思路都失效了.对于滑动验证码,网上能搜到的解决方案基本都是下载图片,还原图片,算出滑动距离,然后模拟js来进行拖动 ...
- ANativeWindow_fromSurface
c++后台若使用ANativeWindow_fromSurface将surface转化为ANativeWindow: 需要头文件:#include <android/native_window_ ...
- pycharm中git配置(coding.net为例)
1.在coding.net注册一个账号 2.登陆coding.net 3.新建项目->输入项目名称.项目描述->初始化仓库选择readme.md并且添加一个appachev2的开源许可证- ...
- debian 配置静态ip
1. 查看虚拟机上本机ipcmd→ipconfig 2. 配置网卡2.1 备份原有配置文件配置文件cp /etc/network/interfaces /etc/network/interfacesb ...
- Java各类型占字节数
byte 1字节short 2字节int 4字节long 8字节float 4字节double 8字节char 2字节boolean 1字节 其中,换算关系: 1GB=1024MB 1MB=1024K ...
- requests模块(请求接口)
下面分别是get,post,入参json,添加cookie,添加header,上传/下载文件 的接口请求举例: import requests #导入模块 #1.发get请求 url = 'htt ...
- base64编解码的两个函数
base64编解码的两个函数,声明,参考网络上的代码实现. unsigned char *base64_encode(unsigned char *str, long* lpBufLen) { lon ...