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 DomashnoCleverLili
- {
- class Program
- {
- static void Main(string[] args)
- {
- // get input --> int age, double washinMashinePrice, double oneToyPrice
- int age = int.Parse(Console.ReadLine());
- double washingMashinePrice = double.Parse(Console.ReadLine());
- double oneToyPrice = double.Parse(Console.ReadLine());
- // determen variables --> accumulate toy, moneySum
- int accumulateToyNumber = 0;
- double moneySum = 0;
- // how many toys
- for (int i = 0; i <= age; i++)
- {
- if (i % 2 == 1)
- {
- accumulateToyNumber++;
- }
- }
- // how much money
- for (int i = 1; i <= age; i++)
- {
- if (i % 2 == 0)
- {
- moneySum += i / 2 * 10;
- moneySum--;
- }
- }
- // all money and are they enough
- double allMoneySum = moneySum + (oneToyPrice * accumulateToyNumber);
- double printEnough = allMoneySum - washingMashinePrice;
- double printNotEnough = washingMashinePrice - allMoneySum;
- // print result
- if (allMoneySum >= washingMashinePrice)
- {
- Console.WriteLine($"Yes! {printEnough:f2}");
- }
- else
- {
- Console.WriteLine($"No! {printNotEnough:f2}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement