HDU 5417 Victor and Machine
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5417
Now, at the 0 second, the machine opens for the first time. Victor wants to know when the n-th ball will be popped out. Could you tell him?
Each line has four integers x, y, w and n. Their meanings are shown above。
1≤x,y,w,n≤100.
Victor有一个机器,这个机器每次开启的瞬间会弹出一个小球,之后每隔ww秒会弹出一个小球。因为机器不是很完善,该机器每开启xx秒就得关闭yy秒进行调整,在机器关闭的瞬间可能会有小球弹出,关闭之后一直到下一次开启之前都不会有小球弹出。 00时刻,机器第一次开启,Victor想要知道第nn个小球弹出的时刻,你能够告诉他吗?
#include <iostream>
using namespace std; int main()
{
int n,w,x,y;
while (cin>>x>>y>>w>>n)
{
int t=,tt=;//tt记录离刚开机多长时间
n--;
while (n>)
{
tt+=w;
if (tt<x)
{
n--;
t+=w;
}
else if (tt==x)
{
n--;
t+=w;
if (n>)
{
tt=;
t+=y;
n--;
}
}
else
{
t+=w+x+y-tt;
tt=;
n--;
}
}
cout <<t<<endl;
}
return ;
}
HDU 5417 Victor and Machine的更多相关文章
- HDOJ 5417 Victor and Machine 水
Victor and Machine Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Othe ...
- hdoj 5417 Victor and Machine
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5417 水题,一开始题目读错了做了好久,每次停工以后都是重新计时. 需要注意的是,先除后乘注意加括号 # ...
- ACM: HDU 5418 Victor and World - Floyd算法+dp状态压缩
HDU 5418 Victor and World Time Limit:2000MS Memory Limit:131072KB 64bit IO Format:%I64d & ...
- HDU 5418 Victor and World 允许多次经过的TSP
题目链接: hdu: http://acm.hdu.edu.cn/showproblem.php?pid=5418 bestcoder(中文): http://bestcoder.hdu.edu.cn ...
- HDU 5418 Victor and World(状压DP+Floyed预处理)
Victor and World Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/131072 K (Java/Other ...
- HDU 5421 Victor and String
Victor and String Time Limit: 1000ms Memory Limit: 262144KB This problem will be judged on HDU. Orig ...
- HDU 5420 Victor and Proposition
Victor and Proposition Time Limit: 6000ms Memory Limit: 524288KB This problem will be judged on HDU. ...
- HDU 4052 Adding New Machine (线段树+离散化)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4052 初始给你w*h的矩阵,给你n个矩形(互不相交),按这些矩形尺寸把初始的矩形扣掉,形成一个新的'矩 ...
- HDU 5067-Harry And Dig Machine(DFS)
Harry And Dig Machine Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Ot ...
随机推荐
- IIC 概述之24c系列存储器内存分析
IIC 型号 容量 器件/业面寻址字节 可寻址位 模块 24C01 128B (1010)(A2)(A1)(A0)(0或 ...
- Python 变量有效范围
- Linux下关闭node应用
今天在折腾用node接入微信公众号时,碰到了node应用启动后卡死退出,需要找出该进程关闭的问题,由于对shell脚本不是很熟悉,记录如下: 我们在用npm start启动应用后,通常要关闭时,ctr ...
- win7系统64位"禁用驱动程序签名强制"如何设置?
换了Win7系统64位旗舰版的朋友是不是都发现了一点,以前32位Win7系统用的好好的小程序小应用,一下子就装不上了.这是由于Win7系统64位系统对于未有认证签名的驱动程序进行了限制安装,而大部分小 ...
- NGINX实现IF语句里的AND,OR多重判断
原理 就是用SET变量进行. AND 就用变量叠加,OR就用0或1切换. nginx的配置中不支持if条件的逻辑与/逻辑或运算 ,并且不支持if的嵌套语法,我们可以用变量的方式来实现: 首先是伪代码( ...
- url的三个js编码函数escape(),encodeURI(),encodeURIComponent()简介
url的三个js编码函数escape(),encodeURI(),encodeURIComponent()简介 2014年10月12日 16806次浏览 引子 浏览器URl地址,上网一定会用到,但是浏 ...
- Powershell ForEach-Object 循环
Powershell管道就像流水线,对于数据的处理是一个环节接着一个环节,如果你想在某一环节对流进来的数据逐个细致化的处理,可是使用ForEach-Object,$_ 代表当前的数据. 对管道对象逐个 ...
- How to run Tomcat without root privileges? 常规用户使用tomcat的80端口
How to run Tomcat without root privileges? 1. The best way is to use jsvc, available as part of the ...
- C#使用WebKitBrowser.dll填坑记
.Net 自带的 Webbrowser 有着太多的平台限制.对于用户体验之上的今天,这无疑是一个噩梦, 然后就开始找 .Net下的WebKitBrowser.dll (后面提供下载) 从开源网站下到程 ...
- Bloom Filter 算法具体解释
Bloom Filter 算法 Bloom filter是由Burton Bloom 在1970年提出的,其后在P2P上得到了广泛的应用.Bloom filter 算法可用来查询某一数据是否在某一数据 ...