After a young rock band wins a music contest, they receive offers from two famous producers. And now they must choose the better one.
The first one offers the young musicians to record an album and distribute it in North America, South America, and Europe. The band makes a research to find out how many albums can be sold in each continent, as well as the price for the music album in local currency.
According to the contract, the producer takes 35% from all profits. The band must pay 20% taxes on the rest of the income.
The second offer includes a world tour with “N” (number of) concerts. Each concert makes the same amount of profit. If the total income from all concerts is more than 100,000 lv the producer keeps 15%.
Your task is to write a program to calculate which offer is better. You’ll be given some numbers.
For the first offer - the number of albums sold in each continent and the price for a single album in each continent.
For the second offer – the number of concerts and the profit from a single concert (it is the same for all concerts). You must convert all currencies in levas. Assume that:
- 1 euro is 1.94lv.
- 1 dollar is 1.72lv.
- 332.74 pesos are 1lv.
Find the profit from all albums, subtract the producer’s share and after that subtract taxes. Finally you must find which of the offers is more profitable. Print your results on the console.
Input
The input data should be read from the console. It will consist of exactly 8 lines:
- The number of albums sold in Europe
- The price of an album in euro
- The number of albums sold in North America
- The price of an album in dollars
- The number of albums sold in South America
- Price of an album in pesos
- The number of concerts during a tour
- Profit from a single concert in euro
The input data will always be valid and in the format described. There is no need to check it explicitly.
Output
The output should be printed on the console.
- If the total profit from all album is more than from all concerts print on the console:
- “Let’s record some songs! They’ll bring us {incomes from albums}lv.”
- If it is equal to or the profit from the concerts is greater:
- “On the road again! We’ll see the world and earn {profit from concerts}lv.”
- All incomes must be rounded to two digits after the decimal point.
Constraints
- The prices for different continents and incomes from concert will be a valid floating-point numbers in range [0…7.9 x 1028]
- The count of albums and concerts will be a valid integers in range [0… 10000]
- Allowed working time for your program: 0.25 seconds.
- Allowed memory: 16 MB.
Examples
Interesting task! Here is my solution:
using System; class BetterMusicProducer18October2015 { static void Main() { decimal numberAlbumsEu = decimal.Parse(Console.ReadLine());//The number of albums sold in Europe decimal priceEu = decimal.Parse(Console.ReadLine());//The price of an album in euro decimal numberAlbumsNorthAmerica = decimal.Parse(Console.ReadLine());//The number of albums sold in North America decimal priceDollars = decimal.Parse(Console.ReadLine());//The price of an album in dollars decimal numberAlbumsSouthAmerica = decimal.Parse(Console.ReadLine());//The number of albums sold in South America decimal pricePessos = decimal.Parse(Console.ReadLine());//Price of an album in pesos decimal numberConcerts = decimal.Parse(Console.ReadLine());//The number of concerts during a tour decimal profitFromOneConcert = decimal.Parse(Console.ReadLine());//Profit from a single concert in euro decimal profitEu = ((numberAlbumsEu * priceEu) * 1.94m); decimal profitNorthA = ((numberAlbumsNorthAmerica * priceDollars) * 1.72m); decimal profitSouthA = ((numberAlbumsSouthAmerica * pricePessos) * 0.0030053495221494m); decimal profitOverall = profitEu + profitNorthA + profitSouthA; decimal producerProcent = (profitOverall * 0.35m); decimal taxes = ((profitOverall - producerProcent) * 0.2m); decimal profitNet = profitOverall - (producerProcent + taxes); decimal profitConcerts = ((numberConcerts * profitFromOneConcert) * 1.94m);//The price of the concert is in euro - that is why we multiply by 1.94 - to get leva if (profitConcerts > 100.000m) { profitConcerts = (profitConcerts - (profitConcerts * 0.15m)); } if (profitNet > profitConcerts) { Console.WriteLine("Let's record some songs! They'll bring us {0:f2}lv.", profitNet); } else if (profitConcerts >= profitNet) { Console.WriteLine("On the road again! We'll see the world and earn {0:f2}lv.", profitConcerts); } } }