Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class Toys
- {
- static void Main()
- {
- //Telerik Academy
- //You are given a certain amount of money (stotinki). There are 3 types of toys you could buy. You should buy the maximum amount of one type of toy possible.
- string input = Console.ReadLine();
- string[] inputSplitted = input.Split(' ');
- decimal[] numbers = Array.ConvertAll<string, decimal>(inputSplitted, decimal.Parse);
- decimal stotinkiS = (numbers[0]),
- priceToy1 = (numbers[1]),
- priceToy2 = (numbers[2]),
- priceToy3 = (numbers[3]);
- int maxToys1 = (int)(stotinkiS / priceToy1),
- maxToys2 = (int)(stotinkiS / priceToy2),
- maxToys3 = (int)(stotinkiS / priceToy3),
- resultToy = maxToys1;
- if (maxToys2 > maxToys1 && maxToys2 > maxToys3)
- {
- resultToy = maxToys2;
- }
- else if (maxToys3 > maxToys2 && maxToys3 > maxToys1)
- {
- resultToy = maxToys3;
- }
- Console.WriteLine(resultToy);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement