HDOJ 5417 Victor and Machine 水
Victor and Machine
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/65536 K (Java/Others)
Total Submission(s): 240 Accepted Submission(s): 134
However, the machine has some flaws, every time after x seconds
of process the machine has to turn off for y seconds
for maintenance work. At the second the machine will be shut down, it may pop out a ball. And while it's off, the machine will pop out no ball before the machine restart.
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.
ball will be popped out.
2 3 3 3
98 76 54 32
10 9 8 100
10
2664
939
/* ***********************************************
Author :CKboss
Created Time :2015年08月22日 星期六 21时57分18秒
File Name :HDOJ5417.cpp
************************************************ */ #include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <string>
#include <cmath>
#include <cstdlib>
#include <vector>
#include <queue>
#include <set>
#include <map> using namespace std; int x,y,w,n; int main()
{
//freopen("in.txt","r",stdin);
//freopen("out.txt","w",stdout); while(cin>>x>>y>>w>>n)
{
int X=x;
int time=0;
for(int i=2;i<=n;i++)
{
if(time+w<=x)
{
time+=w;
}
else
{
time=x;
time+=y;
x=x+y+X;
}
}
cout<<time<<endl;
} return 0;
}
HDOJ 5417 Victor and Machine 水的更多相关文章
- hdoj 5417 Victor and Machine
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5417 水题,一开始题目读错了做了好久,每次停工以后都是重新计时. 需要注意的是,先除后乘注意加括号 # ...
- HDU 5417 Victor and Machine
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5417 Problem Description Victor has a machine. When t ...
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- HDOJ 5418 Victor and World 状压DP
水状压DP Victor and World Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 262144/131072 K (Java ...
- HDOJ/HDU 2560 Buildings(嗯~水题)
Problem Description We divide the HZNU Campus into N*M grids. As you can see from the picture below, ...
- HDOJ(HDU) 1859 最小长方形(水题、、)
Problem Description 给定一系列2维平面点的坐标(x, y),其中x和y均为整数,要求用一个最小的长方形框将所有点框在内.长方形框的边分别平行于x和y坐标轴,点落在边上也算是被框在内 ...
- hdoj 4272 LianLianKan 数据太水
LianLianKan Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total ...
- HDU 5670 Machine 水题
Machine 题目连接: http://acm.hdu.edu.cn/showproblem.php?pid=5670 Description There is a machine with m(2 ...
- hdu-5670 Machine(水题附上java代码)
题目链接: Machine Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) 问题描 ...
随机推荐
- vagrant使用centos的环境安装..
vagrant这货挺好用的..简要就是, 下好virtualbox, vagrant, 然后下个你需要的box. 然后vagrant box add boxname boxpath就行. 然后在合适的 ...
- CTSC+APIO+THUACM游记
退役之前,写点破事乐呵乐呵.. (同DaD3zZ) CTSC Day0 来到丽都 哈哈哈这可是四星级豪华酒店啊 想想要在这住7天 美滋滋 换了半天的房间 也没有换到一起 最后yzy& ...
- 涨知识 --- VI
1.空类所占空间大小 空类所占空间为1,单一继承的空类空间也为1,多继承的空类空间还是1.但是虚继承涉及虚表(虚指针),所以sizeof(C)的大小为4. 2.内联函数与宏定义 Ans:内联函数和普通 ...
- Windows键盘驱动结构与消息机制--转
https://www.douban.com/note/318793892/ 本文主要介绍按键消息是如何传递到窗口并转化为具体的按键消息的. Windows系统是事件驱动的多任务系统,其中按键和鼠标是 ...
- C# winform启动外部exe后,如何完全阻断父界面接收事件,扩展waitforexit
公司的系统搭载了好多奇奇怪怪的exe,以前启动exe后,系统还能接着操作.但是后面又提出额外的需求,说是打开外部exe之后,启动exe的父界面要完全不能进行任何操作.当然按常人所想再加一句waitfo ...
- 在PHP中调用php_ssh实现远程登陆linux服务器并执行shell脚本。
这个功能主要用于在web端利用程序对远程服务器进行操作,通过PHP_ssh执行shell脚本来实现. 首先要安装php_ssh2组件,linux中centos7下有ssh2源,直接安装.window下 ...
- windows编译MaskRCNN
1.代码修改为3.0语言版本 2.setup_windows.py 文件内容为 #!/usr/bin/env python import numpy as np import os # on Wind ...
- Centos6.7 ELK日志系统部署
Centos6.7 ELK日志系统部署 原文地址:http://www.cnblogs.com/caoguo/p/4991602.html 一. 环境 elk服务器:192.168.55.134 lo ...
- SSL&TLS传输层加密协议实现图解--(重要)
一.SSL&TLS 1.SSL:Secure Sockets Layer ,加密套接字协议层 1)SSL是为网络通信提供安全及数据完整性的一种安全协议,在传输层对网络连接进行加密 Secure ...
- Java中内部类详解—匿名内部类
什么是内部类? 将一个类A定义在另一个类B里面,里面的那个类A就称为内部类,B则称为外部类. 成员内部类 定义在类中方法外的类. 定义格式: class 外部类 { class 内部类{ } } ...