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: ...
随机推荐
- bzoj2285
完全是为了拼凑才出出来的吧先分数规划求出到基地入口的最小安全系数然后再最小点权覆盖集,只不过这里是带一定精度实数的流,其实是一样的 ; eps=0.001; type way=record po,ne ...
- BZOJ_1202_狡猾的商人_(并查集)
描述 http://www.lydsy.com/JudgeOnline/problem.php?id=1202 n 个月的账单,共 m 组数据,每一组数据包括 x , y , t ,表示从 x 月到 ...
- 清理ms sql server 大日志文件数据
1.手动分离数据库: 2.手动删除日志文件: 3.重新生成日志文件: CREATE DATABASE FMIS0 ON (FILENAME = 'E:\FMIS0_DATA\FMIS0-Date') ...
- 国内外最全的asp.net开源项目
转自:http://www.cnblogs.com/fengtangquan/archive/2010/10/19/1855472.html 最近一些项目开始用到CMS系统,最开始是研究JAVA的,无 ...
- Java正则表达式应用总结
http://lavasoft.blog.51cto.com/ http://lavasoft.blog.51cto.com/62575/179324 Java正则表达式应用总结 一.概 ...
- django 项目部署在 Apache 后, 设置二级域名(Apache虚拟主机 、 万网二级域名设置)
上一篇文章简单说了怎么把django的项目部署到Apache上. 现在想弄个二级域名,也就是我原来有个域名 www.mysite.com,现在我想弄个 bbs.mysite.com ,该怎么做呢. 要 ...
- Lua 中使用面向对象(续)
上一篇文章给了一个面向对象的方案,美中不足的是没有析构函数 Destructor,那么这一次就给它加上. 既然是析构,那么就是在对象被销毁之前做该做的事情,lua 5.1 的 userdata 可以给 ...
- Android学习笔记(八)深入分析Service启动、绑定过程
Service是Android中一个重要的组件,它没有用户界面,可以运行在后太做一些耗时操作.Service可以被其他组件启动,甚至当用户切换到其他应用时,它仍然可以在后台保存运行.Service 是 ...
- 28个Unix/Linux的命令行神器
下面是Kristóf Kovács收集的28个Unix/Linux下的28个命令行下的工具(原文链接),有一些是大家熟悉的,有一些是非常有用的,有一些是不为人知的.这些工具都非常不错,希望每个人都知道 ...
- 三种纯CSS实现三角形的方法
看到像上图这样的 tip 的小三角,你会怎么办? 切个图上去?恩,不错,简单,兼容性也一级棒,不但好控制,那点小东西也增加不了多少图片的大小.但有没有更好更讲究技巧的办法呢?哈哈,那必须有啊,而且还不 ...