Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Diagnostics;
- namespace demo
- {
- class Program
- {
- static void Main(string[] args)
- {
- int startPoints = int.Parse(Console.ReadLine());
- int count = 0;
- while (startPoints > 0)
- {
- string sector = Console.ReadLine();
- count++;
- //"number section", "double ring",
- //"triple ring", "bullseye"
- if (sector == "number section")
- {
- int pointsFromSector = int.Parse(Console.ReadLine());
- startPoints -= pointsFromSector;
- }
- else if (sector == "double ring")
- {
- int pointsFromSector = int.Parse(Console.ReadLine());
- startPoints -= pointsFromSector * 2;
- }
- else if (sector == "triple ring")
- {
- int pointsFromSector = int.Parse(Console.ReadLine());
- startPoints -= pointsFromSector * 3;
- }
- else if (sector == "bullseye")
- {
- Console.WriteLine($"Congratulations! You won the game with a bullseye in {count} moves!");
- break;
- }
- if (startPoints < 0)
- {
- Console.WriteLine($"Sorry, you lost. Score difference: {Math.Abs(startPoints)}.");
- break;
- }
- }
- if (startPoints == 0)
- {
- Console.WriteLine($"Congratulations! You won the game in {count} moves!");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement