Advertisement
Guest User

Untitled

a guest
Mar 12th, 2019
437
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.32 KB | None | 0 0
  1. using System;
  2.  
  3. namespace P01
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int days = int.Parse(Console.ReadLine());
  10. int players = int.Parse(Console.ReadLine());
  11. double energy = double.Parse(Console.ReadLine());
  12. double water = days * players * double.Parse(Console.ReadLine());
  13. double food = days * players * double.Parse(Console.ReadLine());
  14.  
  15. for (int i = 1; i <= days; i++)
  16. {
  17. energy -= double.Parse(Console.ReadLine());
  18. if (energy <= 0)
  19. {
  20. break;
  21. }
  22. if (i % 2 == 0)
  23. {
  24. water *= 0.7;
  25. energy *= 1.05;
  26. }
  27. if (i % 3 == 0)
  28. {
  29. food -= food / players;
  30. energy *= 1.1;
  31. }
  32. }
  33.  
  34. if (energy > 0)
  35. {
  36. Console.WriteLine($"You are ready for the quest. You will be left with - {energy:f2} energy!");
  37. }
  38. else
  39. {
  40. Console.WriteLine($"You will run out of energy. You will be left with {food:f2} food and {water:f2} water.");
  41. }
  42. }
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement