Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading;
- class Program
- {
- static void Main()
- {
- string name = Console.ReadLine();
- int points = 301;
- int successfulShots = 0;
- int unsuccessfulShots = 0;
- string sector = Console.ReadLine();
- while (sector != "Retire")
- {
- int currentPoints = int.Parse(Console.ReadLine());
- int totalCurrentPoints = 0;
- if (sector == "Single")
- {
- totalCurrentPoints = currentPoints;
- }
- else if (sector == "Double")
- {
- totalCurrentPoints = currentPoints * 2;
- }
- else if (sector == "Triple")
- {
- totalCurrentPoints = currentPoints * 3;
- }
- if (points >= totalCurrentPoints)
- {
- points -= totalCurrentPoints;
- successfulShots++;
- }
- else
- {
- unsuccessfulShots++;
- }
- if (points == 0)
- {
- Console.WriteLine($"{name} won the leg with {successfulShots} shots.");
- break;
- }
- sector = Console.ReadLine();
- }
- if (points != 0)
- {
- Console.WriteLine($"{name} retired after {unsuccessfulShots} unsuccessful shots.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement