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 _02.Умната_Лили
- {
- class Program
- {
- static void Main(string[] args)
- {
- var age = int.Parse(Console.ReadLine());
- var washingPrice = double.Parse(Console.ReadLine());
- var toyPrice = double.Parse(Console.ReadLine());
- double moneyForBD = 10.0;
- double toyCount = 0.0;
- double savedMoney = 0.0;
- double totalMoney = 0.0;
- for (int currAge = 1; currAge < age; currAge++)
- {
- if (currAge % 2 == 0)
- {
- savedMoney += moneyForBD - 1;
- moneyForBD += 10;
- }
- else toyCount++;
- }
- totalMoney = savedMoney + (toyPrice * toyCount);
- if (totalMoney >= washingPrice) Console.WriteLine("Yes!{0:f2}", totalMoney - washingPrice);
- else Console.WriteLine("No!{0:f2}", washingPrice - totalMoney);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement