Article

Time Limit: 20 Sec  Memory Limit: 256 MB

题目连接

http://acm.uestc.edu.cn/#/problem/show/3

Description

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?

Since
World crashes too often, now he is asking his friend ATM for the
optimal strategy to input his article. A strategy is measured by its
expectation keys DRD needs to press.

Note that DRD can press a key at fast enough speed

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

3 1 1 2 10 2 1 3 20 3 1 4 30

Sample Output

Case #1: 10.000
Case #2: 19.000
Case #3: 26.250

HINT

题意

有一个人在bilibili看动漫,看的速度是x,下载的速度是y,一开始等了t秒再播放的,视频总大小为x

然后这个人有个怪癖,就是当出现卡顿的时候,他就会把进度条重新拉回开始位置

然后问你得过多少秒,才能看完整个视频

题解:

高中物理题,随便推推就好啦~

代码:

//qscqesze
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define test freopen("test.txt","r",stdin)
#define maxn 200
#define mod 10007
#define eps 1e-9
int Num;
char CH[];
const int inf=0x3f3f3f3f;
const ll infll = 0x3f3f3f3f3f3f3f3fLL;
inline ll read()
{
ll x=,f=;char ch=getchar();
while(ch<''||ch>''){if(ch=='-')f=-;ch=getchar();}
while(ch>=''&&ch<=''){x=x*+ch-'';ch=getchar();}
return x*f;
}
inline void P(int x)
{
Num=;if(!x){putchar('');puts("");return;}
while(x>)CH[++Num]=x%,x/=;
while(Num)putchar(CH[Num--]+);
puts("");
}
//************************************************************************************** double x,y,t,z;
double cal(double v1,double v2,double s)
{
return s/(v1-v2);
}
void solve()
{
cin>>x>>y>>t>>z;
if(y>=x)
{
printf("%.3lf\n",z/x);
return;
}
double ans=;
double kiss=y*t;
while(cal(x,y,kiss)<z/x)
{
ans+=cal(x,y,kiss);
kiss=cal(x,y,kiss)*x;
}
printf("%.3lf\n",ans+z/x);
}
int main()
{
//test;
int t=read();
for(int cas=;cas<=t;cas++)
{
printf("Case #%d: ",cas);
solve();
}
}

cdoj 03 BiliBili, ACFun… And More! 水题的更多相关文章

  1. UESTCOJ-BiliBili, ACFun… And More!(水题)

    BiliBili, ACFun… And More! Time Limit: 3000/1000MS (Java/Others)     Memory Limit: 65535/65535KB (Ja ...

  2. cdoj 24 8球胜负(eight) 水题

    8球胜负(eight) Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/24 ...

  3. cdoj 71 I am Lord Voldemort 水题

    I am Lord Voldemort Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/ ...

  4. CDOJ 3 BiliBili, ACFun… And More! 模拟

    原题链接:http://acm.uestc.edu.cn/#/problem/show/3 题意: 有个人在看B站视频时有个习惯,就是每当卡住的时候,他总再次从头开始看.另外,他在看视频时会先等待T的 ...

  5. cdoj 26 遮挡判断(shadow) 水题

    遮挡判断(shadow) Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.uestc.edu.cn/#/problem/show/26 ...

  6. 搜索 水题&&错误集锦

    引子: 本以为搜索的题目老师也不会检查,结果今天早上loli慢悠悠的说:“请同学们提交一下搜索的题目~”,顿时心旌摇曳,却也只能装作镇定自若的样子,点了点头.. 然后就开始了今天的疯狂做题,虽说题目都 ...

  7. hdu4530 水题

    题意: 小Q系列故事--大笨钟 Time Limit: 600/200 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others) Total ...

  8. HDOJ 2317. Nasty Hacks 模拟水题

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

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

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

随机推荐

  1. Golang官方图片库

    Golang 的图片出来通过提供操作每一个像素点设置颜色(http://www.cnblogs.com/ghj1976/p/3441536.html) 和 提供通过可选蒙版图片重叠操作 (http:/ ...

  2. 【转】linux之ln命令

    转自:http://www.cnblogs.com/peida/archive/2012/12/11/2812294.html ln是linux中又一个非常重要命令,它的功能是为某一个文件在另外一个位 ...

  3. dzzoffice注册开启

    dzzoffice默认安装注册选线是关闭的,需要在“系统设置”里打开. 设置方法 开始菜单=>系统设置=>注册与访问=> 将允许用户注册选勾,选上. 然后提交保存.

  4. SQL存儲過程的調試方法

    1.在vs2010调试存储过程步骤如下:(要點:連接登陸賬號的權限必須是管理員,才能單步調試,否則只能直接執行存儲過程:[因此,此方式適合數據庫和vs裝在同一台電腦上]) 1.1首先,打开vs,点击 ...

  5. 《The Google File System》论文阅读笔记——GFS设计原理

    一.设计预期 设计预期往往针对系统的应用场景,是系统在不同选择间做balance的重要依据,对于理解GFS在系统设计时为何做出现有的决策至关重要.所以我们应重点关注: 失效是常态 主要针对大文件 读操 ...

  6. something: 重构、正则、vim -- clwu

    项目需要做一个db table 操作的小工具. 从phpMyAdmin上拷贝了一些代码过来修改,但我有没有足够的时间把所有拷贝过来的代码都重构修改和测试完,于是希望后面接手的同事在需要修改这些代码时能 ...

  7. sqlserver安装相关问题

    最近在部署一个工程,数据库(sqlserver2005develop)遇到不少问题,下面将一一列出. 安装完毕后,无法连接到本地实例. 打开microsoft sql server 2005-> ...

  8. ECMAScript 6 入门学习笔记(持续更新)

    1.let命令(作用同var) ES6新增了let命令,用来声明变量.它的用法类似于var,但是所声明的变量,只在let命令所在的代码块内有效. { let a = 10; var b = 1; } ...

  9. HDU 1564 Play a game (找规律博弈)

    Play a game Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total ...

  10. commondline 之一 常识

    用法: 执行类执行 jar 文件 java [-options] class [args...]java [-options] -jar jarfile [args...] 常识:javac Some ...