Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Profit
- {
- class Program
- {
- static void Main(string[] args)
- {
- int r = int.Parse(Console.ReadLine());
- int s = int.Parse(Console.ReadLine());
- int c = int.Parse(Console.ReadLine());
- int maxQuantity = int.Parse(Console.ReadLine());
- double calculate = 0;
- double rasp = 1;
- double straw = 1;
- double cherr = 1;
- for (int i = 1; i <=r; i++)
- {
- for (int j = 1; j <=s; j++)
- {
- for (int k = 1; k <=c; k++)
- {
- calculate = (i * 15) + j * (7.5)+(k*4.5);
- if (calculate == maxQuantity - 1)
- {
- Console.WriteLine($"{calculate}");
- return;
- }
- else if (calculate == maxQuantity)
- {
- Console.WriteLine(calculate);
- return;
- }
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement