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 ...
随机推荐
- iOS中使用ZipArchive压缩和解压缩文件-备
为什么我需要解压缩文件 有许多原因能解释为什么我要在工程中使用压缩和解压缩功能,下面是几个常见的原因: 苹果App Store的50M下载限制 苹 果公司出于流量的考虑,规定在非WIFI环境下,限制用 ...
- resultMap之collection聚集
<select id="getCarsWithCollection" resultMap="superCarResult"> select c1.c ...
- 【转】如何调整visio绘图区域尺寸大小
原文网址:http://jingyan.baidu.com/article/948f5924033870d80ff5f9f1.html 在使用microsoft visio软件绘图时,为了绘图的质量和 ...
- Python partial函数
以前都是摘录的其他网友的博客,很少是自己写的,学习阶段,多多学习.今天开始自己写了,首先写一下刚刚遇到的partial函数. 1.partial函数主要是对参数的改变,假如一个函数有两个参数,而其中一 ...
- ubuntu14.04 cocos2d-x-3.6 glfw编译出错解决方案
lib/libcocos2d.a(CCGLViewImpl-desktop.cpp.o): In function `cocos2d::GLViewImpl::GLViewImpl()': /home ...
- Git冲突解决方案
Git冲突解决方案 1. 在代码提交时,先更新,若有冲突.先解决冲突.若提交之后在review时才发现无法合并代码时有冲突,需要abandon此次提交的代码. 2. 解决冲突的基本做法,保存本地代 ...
- Leetcode:linked_list_cycle
一. 题目 给定一个链表.确定它是否有一个环.不使用额外的空间? 二. 分析 1. 空链表不成环 2. 一个节点自环 3. 一条链表完整成环 思路:使用两个指针,一个每次往前走2步,一 ...
- 生命周期-初识IOS
经常因为生命周期的事情,而视图顺序加载错误,或者出现一系列的小错误并且修改不出来,程序员不知道生命周期确实挺可悲的. IOS生命周期: 自上而下的执行,并且viewDidLoad只会执行一次,所以我们 ...
- 深入解析MySQL replication协议
Why 最开始的时候,go-mysql只是简单的抽象mixer的代码,提供一个基本的mysql driver以及proxy framework,但做到后面,笔者突然觉得,既然研究了这么久mysql c ...
- 什么是系统平均负载(Load average)
一.什么是系统平均负载(Load average)? 在Linux系统中,uptime.w.top等命令都会有系统平均负载load average的输出,那么什么是系统平均负载呢? Load Aver ...