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 ...
随机推荐
- .net core3
- Oracle 提示密码过期问题:the password will expire
SQL> conn scott/tiger ERROR: ORA: the password will expire within days Connected. SQL> conn /a ...
- leetcode_Substring with Concatenation of All Words
You are given a string, S, and a list of words, L, that are all of the same length. Find all startin ...
- SQL SERVER 自带系统存储过程分类
目录存储过程 用于实现 ODBC 数据字典功能,并隔离 ODBC 应用程序以使其不受基础系统表更改的影响. 变更数据捕获存储过程 用于启用.禁用.或报告变更数据捕获对象. 游标存储过程 用于实现游标变 ...
- 【转】 boot.img的解包与打包
原文网址:http://blog.csdn.net/wh_19910525/article/details/8200372 Android 产品中,内核格式是Linux标准的zImage,根文件系统采 ...
- [IOS]包含增删改查移动的tableView展示+plist文件保存+程序意外退出保存Demo
做一个tableView,包含增删改移动功能,并且修改值的时候,在按home键的时候会自动保存.如果可以的话使者保存自定义的类数组保存到plist中. 实现步骤: 1.创建一个SingleViewAp ...
- C# - 创建List属性的简单方法
不用担心List没有创建问题. private ObservableCollection<EquipmentItem> _optionalCollection; public Observ ...
- hdu 5402 Travelling Salesman Problem(大模拟)
Problem Description Teacher Mai ,) to the bottom right corner (n,m). He can choose one direction and ...
- vagrant拷贝后vagrant file需要加的配置
config.ssh.forward_agent config.ssh.username = "vagrant" config.ssh.password = "vagra ...
- C/C++基础概念
1.类占用的内存大小: 1)在不同位数的操作系统下,各种数据类型所占用的内存大小:32位和64位操作系统 http://blog.csdn.net/b_zhang/article/details/68 ...