spasnikolov131

Untitled

Apr 11th, 2022
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.99 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Best_Player
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. string playerName = Console.ReadLine();
  10.  
  11. int succesFullShots = 0;
  12. int unseccesFullShots = 0;
  13. int points = 301;
  14.  
  15. while (points != 0)
  16. {
  17. string line = Console.ReadLine();
  18.  
  19.  
  20. if (line == "Retire")
  21. {
  22.  
  23. Console.WriteLine($"{playerName} retired after {unseccesFullShots} unsuccessful shots.");
  24. break;
  25. }
  26. int num = int.Parse(Console.ReadLine());
  27.  
  28.  
  29. if (line == "Single")
  30. {
  31. if (num <= points && points > 0)
  32. {
  33. points = points - num;
  34. succesFullShots++;
  35. }
  36. }
  37. else
  38. {
  39. unseccesFullShots++;
  40. }
  41. if (line == "Double")
  42. {
  43. if (num <= points && points > 0)
  44. {
  45. points = points - num * 2;
  46. succesFullShots++;
  47. }
  48. }
  49. else
  50. {
  51. unseccesFullShots++;
  52. }
  53. if (line == "Triple")
  54. {
  55. if (num <= points && points > 0)
  56. {
  57. points = points - num * 3;
  58. succesFullShots++;
  59. }
  60. }
  61. else
  62. {
  63. unseccesFullShots++;
  64. }
  65. if (points == 0)
  66. {
  67. Console.WriteLine($"{playerName} won the leg with {succesFullShots} shots.");
  68. break;
  69. }
  70. }
  71.  
  72. }
  73. }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment