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 _12.Clever_Lily
- {
- class Program
- {
- static void Main(string[] args)
- {
- int age = int.Parse(Console.ReadLine());
- double priceWashingMachine = double.Parse(Console.ReadLine());
- int priceToy = int.Parse(Console.ReadLine());
- int toyCount = 0;
- int moneyCount = 0;
- int totalMoney = 0;
- int stolenMoney = 0;
- for (int i = 1; i <= age; i++)
- {
- if (i % 2 == 0)
- {
- moneyCount += 10;
- totalMoney += moneyCount;
- stolenMoney++;
- }
- else
- {
- toyCount++;
- }
- }
- double soldToys = toyCount * priceToy;
- double finalPrice = (totalMoney + soldToys) - stolenMoney;
- if (finalPrice >= priceWashingMachine)
- {
- Console.WriteLine($"Yes! {finalPrice - priceWashingMachine:F2}");
- }
- else
- {
- double diff =Math.Abs(priceWashingMachine - finalPrice);
- Console.WriteLine($"No! {diff:F2}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement