Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace SmartLily
- {
- class Program
- {
- static void Main(string[] args)
- {
- int age = int.Parse(Console.ReadLine());
- double priceWashEngine = double.Parse(Console.ReadLine());
- int priceToy = int.Parse(Console.ReadLine());
- var even = 0.0;
- var evenR = 0.0;
- var brother = 0;
- var odd = 0.0;
- for (int i = 1; i <= age; i++)
- {
- if (i%2==0)
- {
- brother++;
- even += 10;
- evenR += even;
- }
- else
- {
- odd++;
- }
- }
- var allSum = (priceToy*odd)+(evenR - brother);
- var testForWE = allSum - priceWashEngine;
- if (testForWE>=0)
- {
- Console.Write("Yes! ");
- Console.WriteLine($"{testForWE:f2}");
- }
- else
- {
- var middCalc = Math.Abs(testForWE);
- Console.Write("No! ");
- Console.WriteLine($"{middCalc:f2}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement