HDU 5417-Victor and Machine(水题)
2015-08-23 13:04
441 查看
题目地址:HDU 5417
题意:Victor有一个机器,这个机器每次开启的瞬间会弹出一个小球,之后每隔ww秒会弹出一个小球。因为机器不是很完善,该机器每开启xx秒就得关闭yy秒进行调整,在机器关闭的瞬间可能会有小球弹出,关闭之后一直到下一次开启之前都不会有小球弹出。00时刻,机器第一次开启,Victor想要知道第nn个小球弹出的时刻,你能够告诉他吗?
题意:Victor有一个机器,这个机器每次开启的瞬间会弹出一个小球,之后每隔ww秒会弹出一个小球。因为机器不是很完善,该机器每开启xx秒就得关闭yy秒进行调整,在机器关闭的瞬间可能会有小球弹出,关闭之后一直到下一次开启之前都不会有小球弹出。00时刻,机器第一次开启,Victor想要知道第nn个小球弹出的时刻,你能够告诉他吗?
#include <stdio.h> #include <math.h> #include <string.h> #include <stdlib.h> #include <iostream> #include <sstream> #include <algorithm> #include <set> #include <queue> #include <stack> #include <map> #include <bitset> //#pragma comment(linker, "/STACK:102400000,102400000") using namespace std; typedef long long LL; const int inf=0x3f3f3f3f; const double pi= acos(-1.0); const double esp=1e-7; int main() { int x,y,w,n; while(~scanf("%d %d %d %d",&x,&y,&w,&n)){ if(n==1) printf("0\n"); else{ int cnt=1; int t1=0,t2=0; int time=0; int s=0; while(cnt<n){ s+=w; if(s<=x){ time+=w; } else{ time=(t1+1)*x+(t2+1)*y; t1++; t2++; s=0; } cnt++; } printf("%d\n",time); } } return 0; }
相关文章推荐
- 导航寻路
- 2016阿里巴巴校园招聘测试开发工程师笔试附加题(含部分答案)
- hdu2602-Bone Collector(01背包模版题)
- 258 Add Digits
- Android 5.0判断SIM卡(SIM1还是SIM2)
- java对文件新建,删除,复制,剪切,重命名
- arcgis server10.2.2发布地图基础服务的具体步骤
- poj1995-Raising Modulo (快速幂)
- Oracle在rownum使用结果集排序
- JQUERY prop与attr差额
- Robot Framework自动化测试(一)
- arcgis10.2.2地图服务切图具体步骤
- 将无线网卡变身为 wifi 热点的 完整批处理文件 或者 让i电脑变成wifi热点
- 自学QT之QT编程中QList类的removeAt方法记录
- 五款app原型设计工具对比
- leetcode 164: Maximum Gap
- java线程池的使用,实现大量数据的更新操作
- php isset()函数
- 紧急通知英雄联盟90066游戏主播蒙山是大骗子
- Vim学习笔记1---基本操作