V_CIIC_C - Loading

Dickie is downloading some files, his internet connection may be slow as it may be fast, however, he has waited for too long over now and he wants to play as he downloads the files, the 'game' he formulated goes like this.

You are filling a string of length S with the following expression language, the characters will contain one of these, S={0-9,%,-,|}

Now, each character of the string S is a block of file, now, if this block of file is completely filled, you must print a 'pipe' character ('|'), if its not, you must print a dash ('-'), however, if it corresponds to the middle three positions of the string, you must print ([0-9][0-9]%), this corresponds directly to the percentage already downloaded.

Your task is to print the string described above and the time left to download the file entirely, if, for any reason, the time given exceeds the total downloaded file, you should print 'Download is complete'.

INPUT DETAILS:

You are given an integer T, representing the number of test cases, then T lines will follow with four integers each, P, S, F, A, these represents, respectively, the time that already has been downloaded, the number of characters that must be contained in the string S, the size of the files (in megabytes) and the download velocity of the internet connection (given in kilobytes per second). Beware that only the size of the files and the download velocity can be given in floating points.

OUTPUT DETAILS:

For each output you must print the string S as described above, followed by a space and the string “Time left:“, followed by a space and a number H that will be the hours left of the files to download, followed by the string “hs”, followed by a space and then a number M representing the number of minutes, followed by a single character 'm', then a final space and a number C that contains the number of seconds left to download the file.

 

 

INPUT

OUTPUT

4

0 10 100 10

60 20 360 60

900 24 167 52.70

2 10 10 5000

----00%---- Time left: 2hs 46m 40s

---------01%--------- Time left: 1hs 39m 0s

||||||-----28%----------- Time left: 0hs 37m 48s

Download is complete

 

CONSTRAINTS:

0 <= P <= 10^8

5 <= S <= 2T {T € N}

1 <= F <= 1000

10^-2 <= A <= 1000000

 


Added by:Venezuelan Programming League
Date:2013-02-16
Time limit:3s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64

hide comments
2014-11-08 12:06:22 Min_25
@Venezuelan Programming League
The description lacks some important things.

(1) The Rounding method: Should we always use rounddown ?
(2) An example when S is odd: "--10%-" or "-10%--" ? (Does it never happen ?)

My solution uses rounddown and all calculation are done using the Fraction class. Are you sure that the I/O files are correct ?

Last edit: 2015-01-02 06:18:41
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.