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) 问题描 ...
随机推荐
- Django总结二
- 创建app应用与ORM操作 - Django项目project - app(应用) -> 不同的功能放在不同的app中 - 命令 : - 创建app python manage.py sta ...
- ACM_填格子
填格子 Time Limit: 2000/1000ms (Java/Others) Problem Description: 在一个n*n格子里边已经填了部分大写字母,现在给你个任务:把剩下的格子也填 ...
- 跨服务器进行SQL Server数据库的数据处理
exec sp_addlinkedserver 'ITDB', ' ', 'SQLOLEDB', '服务器IP' exec sp_addlinkedsrvlogin 'ITDB', 'false ', ...
- JdbcTemplate:Jdbc模板和数据库元数据
通过 Jdbc .C3P0 .Druid 的使用我们会发现即使我们做了工具的封装,但重复性的代码依旧很多.我们可以通过 JdbcTemplate 即 Jdbc 模板来使我们的代码更加简洁,逻辑更加清晰 ...
- 使用Hexo搭建个人博客配置全过程
大致过程分为: 1.搭建Node.js 环境 2. 搭建Git 环境 3.安装配置Hexo 4.GitHub 注册和配置 5. 关联Hexo 与 GitHub Pages 7.Hexo的常用操作 下面 ...
- html5——网络状态
我们可以通过window.onLine来检测,用户当前的网络状况,返回一个布尔值 window.addEventListener("online",function(){ aler ...
- DOS批处理命令-字符串操作
1.字符串替换 语法结构:%变量名:替换前=替换后% @set str=teh cat in teh hat @echo %str% @set str=%str:teh=the% @echo %str ...
- 6 个 Linux 运维典型问题,大牛的分析解决思路在这里
作为一名合格的 Linux 运维工程师,一定要有一套清晰.明确的解决故障思路,当问题出现时,才能迅速定位.解决问题,这里给出一个处理问题的一般思路: 重视报错提示信息:每个错误的出现,都是给出错误提示 ...
- Unity的分辨率
问题: 强制设置程序运行的分辨率 解决办法: 在程序开始运行时就对分辨率进行设定 设定方法如下: void GetResolution() { int width = Screen.currentRe ...
- EF-Lamdba
一丶基本语法 var userList=db.set<table>().where(c=>c.id=="001"&&c.userName.Cont ...