Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Fourth
- {
- class Program
- {
- static void Main(string[] args)
- {
- string name = Console.ReadLine();
- int goal = 301;
- int scored = 0;
- int notScored = 0;
- while (true)
- {
- string imput = Console.ReadLine();
- if (imput== "Retire")
- {
- break;
- }
- int points = int.Parse(Console.ReadLine());
- if (imput== "Single")
- {
- points = points * 1;
- }
- else if (imput== "Double")
- {
- points = points * 2;
- }
- else if (imput=="Triple")
- {
- points = points * 3;
- }
- if ( points<=goal)
- {
- scored++;
- goal = goal - points;
- }
- else
- {
- notScored++;
- }
- if (goal==0)
- {
- Console.WriteLine("{0} won the leg with {1} shots.", name, scored);
- return;
- }
- }
- Console.WriteLine("{0} retired after {1} unsuccessful shots.",name,notScored);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement