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 ConsoleApp84
- {
- class Program
- {
- static void Main(string[] args)
- {
- string name = Console.ReadLine();
- int pointToBeat = 301;
- string command = Console.ReadLine();
- int succesfullShots = 0;
- int unSuccesfullShots = 0;
- while (pointToBeat == 0)
- {
- string area = Console.ReadLine();
- if (command == "Retire")
- {
- break;
- }
- int points = int.Parse(Console.ReadLine());
- if (area == "Double")
- {
- points *= 2;
- pointToBeat -= points;
- }
- else if (area == "Triple")
- {
- points *= 3;
- pointToBeat -= points;
- }
- if (pointToBeat - points >= 0)
- {
- succesfullShots++;
- }
- else
- {
- unSuccesfullShots++;
- }
- }
- if (pointToBeat == 0)
- {
- Console.WriteLine($"{name} won the leg with {succesfullShots} shots.");
- }
- else if (command == "Retire")
- {
- Console.WriteLine($"{name} retired after {unSuccesfullShots} unsuccessful shots.");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement