Advertisement
Yanislav29

Untitled

Nov 27th, 2019
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.49 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. namespace ConsoleApp6
  5. {
  6. class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. int points = int.Parse(Console.ReadLine());
  11. int moves = 0;
  12. while (points > 0)
  13. {
  14. string sector = Console.ReadLine();
  15. int pointsCnt = int.Parse(Console.ReadLine());
  16. if(sector == "number section")
  17. {
  18. moves++;
  19. points -= pointsCnt;
  20. }
  21. else if (sector == "double ring")
  22. {
  23. moves++;
  24. points -= pointsCnt * 2;
  25. }
  26. else if (sector == "triple ring")
  27. {
  28. moves++;
  29. points -= pointsCnt * 3;
  30. }
  31. else if ( sector == "bullseye")
  32. {
  33. moves++;
  34. Console.WriteLine($"Congratulations! You won the game with a bullseye in {moves} moves!");
  35. break;
  36. }
  37.  
  38. }
  39. if (points == 0)
  40. {
  41. Console.WriteLine($"Congratulations! You won the game in {moves} moves!");
  42. }
  43.  
  44. else if (points < 0)
  45. {
  46. Console.WriteLine($"Sorry, you lost. Score difference: {Math.Abs(points)}.");
  47. }
  48. }
  49. }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement