BestCoder Round #52 (div.2) 1001题
来源:互联网 发布:基于单片机音乐播放器 编辑:程序博客网 时间:2024/06/05 10:56
Victor and Machine
Accepts: 452
Submissions: 1123
Time Limit: 2000/1000 MS (Java/Others)
Memory Limit: 131072/65536 K (Java/Others)
分析:理解题意的时候总是想不明白,想了好久才明白,因为每次重新开始都会弹出一个球,而且每次修理后都会重新开始,理解这些就好了,然后直接模拟就好,1A
代码:
#include <cstdio>#include <cstring>#include <algorithm>#include<iostream>using namespace std;#define LL long longint main(){ int x,y,w,n,a,b; while(cin>>x>>y>>w>>n){ a=x/w; //在要停下修理之前可以弹出的小球个数 b=x%w; int sum=0,t=0; n--; int i; for( i=n;i>0;i--){ //每次开始--,表示弹一个球 if(i-a<=0){ sum+=i*w;//有可能不用弹a个就达到n个要求了 break; } else{ i-=a; sum+=a*w+y+b;//时间和加上从开始一直到再一次的开始 } } cout<<sum<<endl; } return 0;}
0 0
- BestCoder Round #52 (div.2) 1001题
- BestCoder Round #52 (div.2) 1001 Victor and Machine
- hdu5427(BestCoder Round #54 (div.2)1001题)
- BestCoder Round #59 (div.2) 1001 SDOI 模拟题
- BestCoder Round #50 (div.2) 1001
- BestCoder Round #50 (div.2) 1001
- BestCoder Round #57 (div.2)1001
- BestCoder Round #61 (div.2) 1001
- BestCoder Round #72 (div.2)--1001
- BestCoder Round #81 (div.2):1001 Machine
- BestCoder Round #11 (Div. 2)
- BestCoder Round #11 (Div. 2)
- BestCoder Round #50 (div.2)
- BestCoder Round #50 (div.2)
- BestCoder Round 50 (div 2)
- BestCoder Round #50 (div.2)
- #BestCoder Round #50 (div.2)
- BestCoder Round #50 (div.2)
- 回调函数
- 机房收费系统报表制作(vb与数据库)
- Java 线程详解
- perl 根据函数返回值判断
- hiho一下 第六十周 题目1 : String Matching Content Length dp 最长公共子序列
- BestCoder Round #52 (div.2) 1001题
- 为什么我说Rust是靠谱的编程语言
- Win32 中的字符集
- 机房收费系统—项目开发总结报告
- http请求报文详解
- 正则表达式详解及应用
- 黑马程序员——java基础—面向对象
- Best coder 52div21001Victor and Machine
- sort 与Qsort 排序