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
1 1 2 10
2 1 3 20
3 1 4 30
Case #1: 10.000
Case #2: 19.000
Case #3: 26.250

好久没有刷题了,最近又因为考试,就只能偶尔刷刷水题。题意不说了,在纸上画一下利用物理知识就能解决了。

 #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!(水题)的更多相关文章

  1. cdoj 03 BiliBili, ACFun… And More! 水题

    Article Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/3 Descr ...

  2. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  3. ACM :漫漫上学路 -DP -水题

    CSU 1772 漫漫上学路 Time Limit: 1000MS   Memory Limit: 131072KB   64bit IO Format: %lld & %llu Submit ...

  4. ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)

    1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 154  Solved: 112[ ...

  5. [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 ...

  6. gdutcode 1195: 相信我这是水题 GDUT中有个风云人物pigofzhou,是冰点奇迹队的主代码手,

    1195: 相信我这是水题 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 821  Solved: 219 Description GDUT中有个风云人 ...

  7. BZOJ 1303 CQOI2009 中位数图 水题

    1303: [CQOI2009]中位数图 Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 2340  Solved: 1464[Submit][Statu ...

  8. 第十一届“蓝狐网络杯”湖南省大学生计算机程序设计竞赛 B - 大还是小? 字符串水题

    B - 大还是小? Time Limit:5000MS     Memory Limit:65535KB     64bit IO Format: Description 输入两个实数,判断第一个数大 ...

  9. ACM水题

    ACM小白...非常费劲儿的学习中,我觉得目前我能做出来的都可以划分在水题的范围中...不断做,不断总结,随时更新 POJ: 1004 Financial Management 求平均值 杭电OJ: ...

随机推荐

  1. 在linux系统下怎么安装两个nginx

    在linux下安装nginx的时候,一般在./configure的阶段会要求通过prefix设置安装路径.因此,在./configure的时候指定不同的prefix就可以安装多个nginx啦. 值得注 ...

  2. bzoj2285

    完全是为了拼凑才出出来的吧先分数规划求出到基地入口的最小安全系数然后再最小点权覆盖集,只不过这里是带一定精度实数的流,其实是一样的 ; eps=0.001; type way=record po,ne ...

  3. 解决ubuntu合盖后无法唤醒

    解决办法: 安装laptop-mode-tools工具包 1. 检查是否安装了grep laptop-mode-tools 工具包 $ dpkg -l | grep laptop-mode-tools ...

  4. leecode 回文字符串加强版

    Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignori ...

  5. Bzoj 1579: [Usaco2009 Feb]Revamping Trails 道路升级 dijkstra,堆,分层图

    1579: [Usaco2009 Feb]Revamping Trails 道路升级 Time Limit: 10 Sec  Memory Limit: 64 MBSubmit: 1573  Solv ...

  6. Delphi的四舍五入函数

    一.四舍五入法    四舍五入是一种应用非常广泛的近似计算方法,其有算术舍入法和银行家舍入法两种.    所谓算术舍入法,就是我们通常意义上的四舍五入法.其规则是:当舍去位的数值大于等于5时,在舍去该 ...

  7. use of undeclared identifier *** , did you mean ***. in xcode

    A property is not the same thing os a instance variable, you should read a little bit of them, there ...

  8. Shell数组:shell数组的定义、数组长度

    Shell在编程方面比Windows批处理强大很多,无论是在循环.运算. bash支持一维数组(不支持多维数组),并且没有限定数组的大小.类似与C语言,数组元素的下标由0开始编号.获取数组中的元素要利 ...

  9. jsp 多条记录提交

    前端jsp页面可以通过form提交标有name属性值得input的value数据给服务器,其中如何传递数组形式呢?如下: 1.前端jsp页面 其中灰色的部分是一个循环出现的值,因此form提交后,后台 ...

  10. ios 码云的使用总结

    今天将项目丢到码云上进行管理,遇到一些比较蛋疼的地方,做个记录,以后方便查询. 码云其实和gitHub差不多,只是在码云上做公司项目的时候设置为私有项目是免费的,貌似在gitHub上是要收费的.本文是 ...