Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. using System;
  2. using System.Text.RegularExpressions;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5.  
  6. namespace ConsoleApp18
  7. {
  8. class Program
  9. {
  10. static void Main(string[] args)
  11. {
  12. double neededExperiance = double.Parse(Console.ReadLine());
  13. int countOfBattles = int.Parse(Console.ReadLine());
  14.  
  15. double totalExperiance = 0;
  16. for (int i = 1; i <= countOfBattles; i++)
  17. {
  18. double experiancePerBattle = double.Parse(Console.ReadLine());
  19. totalExperiance += experiancePerBattle;
  20. if (i%3==0)
  21. {
  22. totalExperiance += experiancePerBattle * 0.15;
  23. }
  24. if (i%5==0)
  25. {
  26. totalExperiance -= experiancePerBattle * 0.1;
  27. }
  28. if (totalExperiance>=neededExperiance)
  29. {
  30. Console.WriteLine($"Player successfully collected his needed experience for {i} battles.");
  31. break;
  32. }
  33.  
  34. }
  35. if (totalExperiance<neededExperiance)
  36. {
  37. Console.WriteLine($"Player was not able to collect the needed experience, {(neededExperiance-totalExperiance):f2} more needed.");
  38. }
  39.  
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement