hdu 5417 Victor and Machine
来源:互联网 发布:勇士vs马刺数据统计 编辑:程序博客网 时间:2024/06/05 10:04
题目:点击打开链接
题解:
判断特殊情况
#include <iostream>#include <cstdio>#include <cmath>#include <cstring>using namespace std;int main(){ int x,y,w,n,t,m; while(scanf("%d%d%d%d",&x,&y,&w,&n)!=EOF) { if(n==1) { printf("0\n"); continue;//只有一个的话在一开机瞬间就出来了 } else if(x<w) t=(n-1)*(x+y);//如果x<w,说明只能在每次开机时掉一个,但是最后一个不需要计时,所以(n-1)*(x+y) else { int a=x/w+1;//每个x区间可以出多少个球 if(n%a==0) t=(n/a)*(x+y)-y-x%w;//减去不出球的区间y和x%w else t=(n/a)*(x+y)+(n%a-1)*w;//还差几个就把差的时间加上 } printf("%d\n",t); } return 0;}
0 0
- hdu 5417 Victor and Machine
- hdu 5417 Victor and Machine
- HDU 5417 Victor and Machine
- HDU-5417Victor and Machine
- hdu 5417 Victor and Machine
- hdu 5417 Victor and Machine
- hdu 5417 Victor and Machine
- hdu 5417 Victor and Machine 思考题
- hdu 5417 Victor and Machine(简单数学题)
- hdu 5417 Victor and Machine(模拟)
- HDU 5417-Victor and Machine(水题)
- hdu 5417 Victor and Machine 模拟
- hdu 5417 Victor and Machine(水)
- HDOJ 5417 Victor and Machine
- HDU 5417 Victor and Machine(模拟||递推)
- HDOJ 5417 Victor and Machine 水
- HDOJ 5417 Victor and Machine(模拟)
- Victor and Machine
- SDUTOJ3252---Lowest Unique Price
- 20150902 Java学习笔记-构造方法,关键字,封装性
- Linux套接字与虚拟文件系统(1):初始化和创建 http://www.cppblog.com/qinqing1984/archive/2015/05/03/210521.html
- android-------采用AIDL调用远程服务
- CIDR与NAT
- hdu 5417 Victor and Machine
- 【codechef】Singal Pipes(DFS求期望)
- 初始化和清除
- iOS 9.0 随机数
- POJ 2125 Destroying The Graph(二分图最小点权覆盖)
- HDU 4916(Count on the path-树上除链上的节点外最小值[强制在线])
- Maven系列2--pom.xml 配置详解
- Android任务和返回栈(Tasks and Back Stack)
- Block Formatting Contexts