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返回json给钱前台的方法
return HttpResponse(simplejson.dumps(resource.update_status, ensure_ascii=False))
- Zabbix Server参数文件详解
Zabbix的配置文件一般有三种: zabbix_server.conf:zabbix server的配置文件 zabbix_proxy.conf:zabbix proxy的配置文件 zabbix_a ...
- 【原】cocos2d-x开发笔记:获取Sprite上某一个点的透明度,制作不规则按钮
本篇文章主要讲一下怎么做一个不规则的按钮,比如如下图的八卦,点击绿色和点击红色部分,需要执行不同的事件
- netty学习:UDP服务器与Spring整合
最近接到一个关于写UDP服务器的任务,然后去netty官网下载了netty的jar包(netty-4.0.49.Final.tar.bz2),解压后,可以看到上面有不少example,找到其中的关于U ...
- 图论 Make Unique:有向图和无向图的一些算法
计算机科学入门资料之一的<算法与数据结构-C语言版>,覆盖了基础算法的几乎所有分支,其中的一个典型分支为图理论. 一个简介:图论基础-图数据结构基础 一个简洁的博客:图论基础,简列一本书 ...
- 在centos安装 sql server
主要参考官方文档https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-red-hat
- linux中集群的免秘钥SSH直接登录
这里以三台mysql的主从服务器为例:manage.master.slave1.slave2 给4个机器生成秘钥文件 以manage为例,执行命令,生成空字符串的秘钥(后面要使用公钥),命令是: ...
- tab切换案例
做个简单的tab切换效果,分别于jquery和js操作 (1)jQuery操作 先看下效果: <!DOCTYPE html> <html lang="en"> ...
- vue-cli3 中的环境变量
官方文档是这样写的: src同名文件夹下的建立 .env.[model] 配置文件 // mode:production development ... 载入的变量会对vue-cli-service ...
- jquery spa
1.hashchange监听 2.根据url加载不同页面 $.ajax({ url:"/xx/xx.html" type:"get", dataType:&qu ...