Advertisement
anizko

08. Clever Lily (not included in final score)

Apr 10th, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Clever_Lily
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int YearLili = int.Parse(Console.ReadLine());
  10. double priceWashing = double.Parse(Console.ReadLine());
  11. double priceGame = double.Parse(Console.ReadLine());
  12.  
  13. double total = 0;
  14. double money = 0;
  15.  
  16. for(int i=1;i<= YearLili;i++)
  17. {
  18. if(i%2==0)
  19. {
  20. money += 10;
  21. total += money;
  22. total--;
  23. }
  24. else
  25. {
  26. total += priceGame;
  27. }
  28. }
  29. if(total>=priceWashing)
  30. {
  31. Console.WriteLine($"Yes! {total - priceWashing:f2}");
  32. }
  33. else
  34. {
  35. Console.WriteLine($"No! {priceWashing- total:f2}");
  36.  
  37. }
  38.  
  39.  
  40.  
  41.  
  42.  
  43.  
  44. }
  45. }
  46. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement