Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Program
- {
- public static void Main()
- {
- int N = int.Parse(Console.ReadLine());
- var laundryPrice = double.Parse(Console.ReadLine());
- var toyPrice = int.Parse(Console.ReadLine());
- var deposit = 0;
- var moneyFromToys = 0;
- var money = 10;
- for (int i=1; i<=N;i++)
- {
- if (i%2 == 0)
- {
- deposit += money;
- deposit-=1;
- money+=10;
- }
- else
- {
- moneyFromToys+=toyPrice;
- }
- }
- var total = deposit + moneyFromToys;
- if(total>=laundryPrice)
- {
- Console.WriteLine("Yes! {0:f2}",total-laundryPrice);
- }
- else
- {
- Console.WriteLine("No! {0:f2}", laundryPrice-total);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment