Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Best_Player
- {
- class Program
- {
- static void Main(string[] args)
- {
- string playerName = Console.ReadLine();
- int succesFullShots = 0;
- int unseccesFullShots = 0;
- int points = 301;
- while (points != 0)
- {
- string line = Console.ReadLine();
- if (line == "Retire")
- {
- Console.WriteLine($"{playerName} retired after {unseccesFullShots} unsuccessful shots.");
- break;
- }
- int num = int.Parse(Console.ReadLine());
- if (line == "Single")
- {
- if (num <= points && points > 0)
- {
- points = points - num;
- succesFullShots++;
- }
- }
- else
- {
- unseccesFullShots++;
- }
- if (line == "Double")
- {
- if (num <= points && points > 0)
- {
- points = points - num * 2;
- succesFullShots++;
- }
- }
- else
- {
- unseccesFullShots++;
- }
- if (line == "Triple")
- {
- if (num <= points && points > 0)
- {
- points = points - num * 3;
- succesFullShots++;
- }
- }
- else
- {
- unseccesFullShots++;
- }
- if (points == 0)
- {
- Console.WriteLine($"{playerName} won the leg with {succesFullShots} shots.");
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment