SHARE
TWEET

Untitled

MartinGerov Oct 18th, 2019 104 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp84
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             string name = Console.ReadLine();
  14.             int pointToBeat = 301;
  15.             string command = Console.ReadLine();
  16.             int succesfullShots = 0;
  17.             int unSuccesfullShots = 0;
  18.  
  19.             while (pointToBeat == 0)
  20.             {
  21.                 string area = Console.ReadLine();
  22.                 if (command == "Retire")
  23.                 {
  24.                     break;
  25.                 }
  26.  
  27.                 int points = int.Parse(Console.ReadLine());
  28.                 if (area == "Double")
  29.                 {
  30.                     points *= 2;
  31.                     pointToBeat -= points;
  32.                 }
  33.                 else if (area == "Triple")
  34.                 {
  35.                     points *= 3;
  36.                     pointToBeat -= points;
  37.                 }
  38.                 if (pointToBeat - points >= 0)
  39.                 {
  40.                     succesfullShots++;
  41.                    
  42.                 }
  43.                 else
  44.                 {
  45.                     unSuccesfullShots++;
  46.                 }
  47.                
  48.             }
  49.             if (pointToBeat == 0)
  50.             {
  51.                 Console.WriteLine($"{name} won the leg with {succesfullShots} shots.");
  52.             }
  53.             else if (command == "Retire")
  54.             {
  55.                 Console.WriteLine($"{name} retired after {unSuccesfullShots} unsuccessful shots.");
  56.             }
  57.         }
  58.     }
  59. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top