Torrent Pirate TASK
Здравейте!
Някой би ли ми помогнал със следната задача:
** Torrent Pirate
Captain Jack Sparrow is a famous pirate. He loves to steal different stuff just for fun and he loves watching movies. He recently discovered a brand new technology called peer-to-peer or torrent. After he browsed a famous site, he made a collection of movies he would like to download. Assume 1 movie has a size of 1500MB. Jack doesn’t want to pay for the internet, so he decided to go to the mall and use the free Wi-Fi there. The Wi-Fi has a fixed speed of 2MB/s. Unfortunately for Jack, his wife will be going with him to the mall and this means that the download would not be free at all. She likes to buy sandals and other useless stuff. You are given the money his wife spends per hour at the mall.
Your task is to help Jack calculate whether it is cheaper to go to the mall and download the movies or go to the cinema to watch them. If the amount is the same, Jack still wants to make his wife happy, so he goes to the mall.
Input
The input data should be read from the console. It consists of three input values, each at a separate line:
•Download data d: how much megabytes in total Jack should download.
•Price of cinema p: how much money would cost Jack to go to the cinema to watch one movie.
•Wife spending w: how much money per hour does Jack’s wife spend.
The input data will always be valid and in the format described. There is no need to check it explicitly.
Output
•The output data must be printed on the console.
•On the only output line you must print “{place to go} -> {price to pay}lv”.
•The price to pay should be formatted with 2 digits after the decimal sign.
Constraints
•d is an integer number in range [0...2,147,483,647]. p is an integer number in range [0…30]. w is an integer number in range [0…200].
•Allowed working time for your program: 0.25 seconds.
•Allowed memory: 16 MB.
Решението, което за мен на конзола работи е по-долу, обаче judge системата ми го връща като невалидно:
double megabites = double.Parse(Console.ReadLine());
double cinemaCost = double.Parse(Console.ReadLine());
double wifeSpend = double.Parse(Console.ReadLine());
double minutes = (megabites/2)/60;
double spendPerMinute = wifeSpend/60;
double totalSpend = minutes * spendPerMinute;
double totalMovies = megabites / 1500;
double totalMovieSum = totalMovies * cinemaCost;
if (totalSpend <= totalMovieSum)
Console.WriteLine ("mall-> {0:C2}", totalSpend);
else
{
Console.WriteLine("cinеma->{0:C2}", totalMovieSum);
}
Очевидно има грешка, но не знам къде.
Благодаря предварително!
Много благодаря за отговора! :)