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 cleverLily
- {
- class Program
- {
- static void Main(string[] args)
- {
- int ageLily = int.Parse(Console.ReadLine());
- double wash = double.Parse(Console.ReadLine());
- double toyPrice = double.Parse(Console.ReadLine());
- double money = 0;
- double moneyMax = 0;
- int brotherTake = 0;
- int numToy = 0;
- for (int itoy = 1; itoy <= ageLily; itoy++)
- {
- if (itoy % 2 == 1)
- {
- numToy++;
- }
- }
- double allToyPrice = toyPrice * numToy;
- for (int imoney = 1; imoney <= ageLily; imoney++)
- {
- if (imoney % 2 == 0)
- {
- money += 10;
- moneyMax += money;
- brotherTake++;
- }
- }
- double allMoney = allToyPrice + moneyMax - brotherTake;
- //Console.WriteLine(moneyMax);
- //Console.WriteLine(allToyPrice);
- //Console.WriteLine(allMoney);
- if (wash <= allMoney)
- {
- Console.WriteLine($"Yes! {(allMoney - wash):F2}");
- }
- else
- {
- Console.WriteLine($"No! {(wash - allMoney):F2}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment