zoukankan      html  css  js  c++  java
  • 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.

    201305171505582061.jpg

    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 XYT, 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. (T1000).For each case, there will be four integers XYT 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. (1X,Y,T201S100).

    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 InputSample 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

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

     1 #include<stdio.h>
     2 int main ()
     3 {
     4     int i=1;
     5     double t0,x,y,t,s;
     6     double time,t1,xTime,yTime,catchtime;
     7     scanf("%lf",&t0);
     8     while(t0--){
     9         scanf("%lf%lf%lf%lf",&x,&y,&t,&s);
    10         time=0;
    11         xTime=0;
    12         yTime=t;
    13         if(x<=y) time+=s/x;
    14         else{
    15             catchtime=y*t/(x-y);
    16             while(catchtime<s/x){
    17                 xTime+=catchtime;
    18                 yTime+=catchtime;
    19                 catchtime=y*yTime/(x-y);
    20             }
    21             time+=xTime+s/x;
    22         }
    23         printf("Case #%d: %.3f
    ",i++,time);
    24     }
    25     return 0;
    26 }
  • 相关阅读:
    用三张图宏观把握数据库
    MySQL数据库安装与配置详解(图文)
    如何彻底的删除MySQL数据库(图文教程)
    几个常用网络/服务器监控开源软件
    tomcat服务器虚拟目录的映射方式
    手动开发动态资源之servlet初步
    软件项目开发没规划好就注定会失败
    在系统设计中,如何控制层次的问题
    软件系统架构中的分层思想
    鸟哥谈PHP的架构与未来发展
  • 原文地址:https://www.cnblogs.com/RRirring/p/4614414.html
Copyright © 2011-2022 走看看