UESTCOJ-BiliBili, ACFun… And More!(水题)
BiliBili, ACFun… And More!
Time Limit: 3000/1000MS (Java/Others) Memory Limit: 65535/65535KB (Java/Others)
Some of you may have already noticed, there is a team in our final contest whose name is UESTC_BiliBilii
, with user id as ACfun
. Actually, both of them are websites mainly for watching videos.
So in this problem we also deal with video-share websites. When watching videos online, two numbers are very important. One is the playing speed: the speed you play the video, say X KB per second. The other is the downloading speed: the speed the computer downloads the video from the internet, say Y KB per second. Obviously, if X>Y, then you may have to pause for some time, since you cannot play something that hasn’t been downloaded!
The playing speed can also be described as the moving speed of the circle at the bottom of the videos, see the pictures below.
The circle will move along the blue bar, which is full now, indicating that downloading is already complete.
In this problem, we suppose that X and Y will always be constant.
Kennethsnow has a special habit when watching videos, let me tell you. First of all, he will wait for some time to download part of the video, say T seconds. Then, he starts to play the video.
If at a certain time, the video is paused, then kennethsnow will move the cursor(The circle in the picture) instantly to the leftmost position! That means, he will watch the video again, from the very beginning.
He will do this again and again, until the video comes to an end. Given X, Y, T, and the total size of the video, what is the time kennethsnow needs, to finish his watching?
Input
The first line of input contains a number T, indicating the number of test cases. (T≤1000).For each case, there will be four integers X, Y, T and S, which is the playing speed, downloading speed, the time kennethsnow will wait before playing, and the total size of video, given in KB. (1≤X,Y,T≤20, 1≤S≤100).
Output
For each case, output Case #i:
first. (i is the number of the test case, from 1 to T). Then output the time kennethsnow needs to finish watching, in decimals, round to 3 decimal places.
Sample input and output
Sample Input | Sample Output |
---|---|
3 |
Case #1: 10.000 |
好久没有刷题了,最近又因为考试,就只能偶尔刷刷水题。题意不说了,在纸上画一下利用物理知识就能解决了。
#include<stdio.h>
int main ()
{
int i=;
double t0,x,y,t,s;
double time,t1,xTime,yTime,catchtime;
scanf("%lf",&t0);
while(t0--){
scanf("%lf%lf%lf%lf",&x,&y,&t,&s);
time=;
xTime=;
yTime=t;
if(x<=y) time+=s/x;
else{
catchtime=y*t/(x-y);
while(catchtime<s/x){
xTime+=catchtime;
yTime+=catchtime;
catchtime=y*yTime/(x-y);
}
time+=xTime+s/x;
}
printf("Case #%d: %.3f\n",i++,time);
}
return ;
}
UESTCOJ-BiliBili, ACFun… And More!(水题)的更多相关文章
- cdoj 03 BiliBili, ACFun… And More! 水题
Article Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/3 Descr ...
- HDOJ 2317. Nasty Hacks 模拟水题
Nasty Hacks Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Tota ...
- ACM :漫漫上学路 -DP -水题
CSU 1772 漫漫上学路 Time Limit: 1000MS Memory Limit: 131072KB 64bit IO Format: %lld & %llu Submit ...
- ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)
1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 154 Solved: 112[ ...
- [poj2247] Humble Numbers (DP水题)
DP 水题 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The se ...
- gdutcode 1195: 相信我这是水题 GDUT中有个风云人物pigofzhou,是冰点奇迹队的主代码手,
1195: 相信我这是水题 Time Limit: 1 Sec Memory Limit: 128 MBSubmit: 821 Solved: 219 Description GDUT中有个风云人 ...
- BZOJ 1303 CQOI2009 中位数图 水题
1303: [CQOI2009]中位数图 Time Limit: 1 Sec Memory Limit: 162 MBSubmit: 2340 Solved: 1464[Submit][Statu ...
- 第十一届“蓝狐网络杯”湖南省大学生计算机程序设计竞赛 B - 大还是小? 字符串水题
B - 大还是小? Time Limit:5000MS Memory Limit:65535KB 64bit IO Format: Description 输入两个实数,判断第一个数大 ...
- ACM水题
ACM小白...非常费劲儿的学习中,我觉得目前我能做出来的都可以划分在水题的范围中...不断做,不断总结,随时更新 POJ: 1004 Financial Management 求平均值 杭电OJ: ...
随机推荐
- Android中的六大布局
继承关系图: 布局XML文件中常用属性: android:layout_width 宽度 android:layout_height 高度 可能的取值为match_parent,wrap_conte ...
- linux ERROR: ld.so: object '/lib/libcwait.so' from /etc/ld.so.preload cannot be preloaded: ignored.
[root@ora9i 3238244]# lsb_release -a LSB Version: :core-3.0-amd64:core-3.0-ia32:core-3.0-noarch:g ...
- HDU 5965 扫雷 【模拟】 (2016年中国大学生程序设计竞赛(合肥))
扫雷 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submissi ...
- [PeterDLax著泛函分析习题参考解答]第4章 Hahn-Bananch 定理的应用
1. 证明: 若在 4.1 节中取 $S=\sed{\mbox{正整数}}$, $Y$ 是收敛数列构成的空间, $\ell$ 由 (14) 式定义, 则由 (4) 给出的 $p$ 和由 (11) 定义 ...
- PHP导出MySQL数据到Excel
经常会碰到需要从数据库中导出数据到Excel文件,用一些开源的类库,比如PHPExcel,确实比较容易实现,但对大量数据的支持很不好,很容易到达PHP内存使用上限.这里的方法是利用fputcsv写CS ...
- Linux常用命令及vim的使用、vim常用插件(推荐)
看了3篇文章,很好 vim中的区域拷贝 剪切,粘贴: 正常模式,移动光标到剪切的区域开始处,按v,进入可视模式,然后选择区域.按x键,剪切.到指定位置按p粘贴. 撤销按u 恢复按ctrl-r 简明 ...
- 激活Navicat?如何注册Navicat?
在注册界面里面输入信息 名:顺便输入 组织:顺便输入 注册码:NAVH-WK6A-DMVK-DKW3
- Intellij IDEA调试
这段时间一直在使用Intellij IDEA, 今天把调试区工具的使用方法记录于此. 先编译好要调试的程序. 1.设置断点 选定要设置断点的代码行,在行号的区域后面单击鼠标左键即可. 2.开启调试会话 ...
- Hibernate中inverse属性与cascade属性
Hibernate集合映射中,经常会使用到"inverse"和"cascade"这两个属性.对于我这样,Hibernate接触不深和语文水平够烂的种种因素,发现 ...
- use SWF / Flash in cocos2d-x; cocos2d(cocos2d-x) 直接播放flash / SWF文件
前段时间移植一个页游到手游,原先页游的项目里面有1000+的Flash人物,宠物动画,特效. 这要是全部重新做一遍,还不累死人?所以就想干脆直接在Cocos2d(x)里面播放SWF文件.(包括场景,过 ...