codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

195A.md (3004B)


      1 Source: https://codeforces.com/problemset/problem/195/A
      2 
      3 A. Let's Watch Football
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 Valeric and Valerko missed the last Euro football game, so they decided to watch the game's key moments on the Net. They want to start watching as soon as possible but the connection speed is too low. If they turn on the video right now, it will "hang up" as the size of data to watch per second will be more than the size of downloaded data per second.
     22 
     23 The guys want to watch the whole video without any pauses, so they have to wait some integer number of seconds for a part of the video to download. After this number of seconds passes, they can start watching. Waiting for the whole video to download isn't necessary as the video can download after the guys started to watch.
     24 
     25 Let's suppose that video's length is *c* seconds and Valeric and Valerko wait *t* seconds before the watching. Then for any moment of time *t*0, *t* ≤ *t*0 ≤ *c* + *t*, the following condition must fulfill: the size of data received in *t*0 seconds is not less than the size of data needed to watch *t*0 - *t* seconds of the video.
     26 
     27 Of course, the guys want to wait as little as possible, so your task is to find the minimum integer number of seconds to wait before turning the video on. The guys must watch the video without pauses.
     28 
     29 Input
     30 
     31 The first line contains three space-separated integers *a*, *b* and *c* (1 ≤ *a*, *b*, *c* ≤ 1000, *a* > *b*). The first number (*a*) denotes the size of data needed to watch one second of the video. The second number (*b*) denotes the size of data Valeric and Valerko can download from the Net per second. The third number (*c*) denotes the video's length in seconds.
     32 
     33 Output
     34 
     35 Print a single number — the minimum integer number of seconds that Valeric and Valerko must wait to watch football without pauses.
     36 
     37 Examples
     38 
     39 Input
     40 
     41 ```
     42 4 1 1
     43 ```
     44 
     45 Output
     46 
     47 ```
     48 3
     49 ```
     50 
     51 Input
     52 
     53 ```
     54 10 3 2
     55 ```
     56 
     57 Output
     58 
     59 ```
     60 5
     61 ```
     62 
     63 Input
     64 
     65 ```
     66 13 12 1
     67 ```
     68 
     69 Output
     70 
     71 ```
     72 1
     73 ```
     74 
     75 Note
     76 
     77 In the first sample video's length is 1 second and it is necessary 4 units of data for watching 1 second of video, so guys should download 4 · 1 = 4 units of data to watch the whole video. The most optimal way is to wait 3 seconds till 3 units of data will be downloaded and then start watching. While guys will be watching video 1 second, one unit of data will be downloaded and Valerik and Valerko will have 4 units of data by the end of watching. Also every moment till the end of video guys will have more data then necessary for watching.
     78 
     79 In the second sample guys need 2 · 10 = 20 units of data, so they have to wait 5 seconds and after that they will have 20 units before the second second ends. However, if guys wait 4 seconds, they will be able to watch first second of video without pauses, but they will download 18 units of data by the end of second second and it is less then necessary.