Advertisement
iliqnvidenov

Untitled

Mar 30th, 2015
361
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.58 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. class Program
  8. {
  9.     static void Main()
  10.     {
  11.         int nakovsPoints = 0;
  12.         int simeonsPoints = 0;
  13.         int rounds = 0;
  14.         string playerToStart = Console.ReadLine();
  15.         int numberOfRounds = int.Parse(Console.ReadLine());
  16.         for (int i = 0; i < numberOfRounds; i++)
  17.         {
  18.             rounds++;
  19.             if (playerToStart == "Simeon")
  20.             {
  21.                 int pointsToScore = int.Parse(Console.ReadLine());
  22.                 string whatHeDone = Console.ReadLine();
  23.                 if (whatHeDone == "success")
  24.                 {
  25.                     if (simeonsPoints + pointsToScore <= 500)
  26.                     {
  27.                         simeonsPoints += pointsToScore;
  28.                     }
  29.                 }
  30.                 if (simeonsPoints == 500)
  31.                 {
  32.                     Console.WriteLine("Simeon");
  33.                     Console.WriteLine(rounds);
  34.                     Console.WriteLine(nakovsPoints);
  35.                     return;
  36.                 }
  37.                 pointsToScore = int.Parse(Console.ReadLine());
  38.                 whatHeDone = Console.ReadLine();
  39.                 if (whatHeDone == "success")
  40.                 {
  41.                     if (nakovsPoints + pointsToScore <= 500)
  42.                     {
  43.                         nakovsPoints += pointsToScore;
  44.                     }
  45.                 }
  46.                 playerToStart = "Nakov";
  47.                 if (nakovsPoints == 500)
  48.                 {
  49.                     Console.WriteLine("Nakov");
  50.                     Console.WriteLine(rounds);
  51.                     Console.WriteLine(simeonsPoints);
  52.                     return;
  53.                 }
  54.             }
  55.             else
  56.             {
  57.                 int pointsToScore = int.Parse(Console.ReadLine());
  58.                 string whatHeDone = Console.ReadLine();
  59.                 if (whatHeDone == "success")
  60.                 {
  61.                     if (nakovsPoints + pointsToScore <= 500)
  62.                     {
  63.                         nakovsPoints += pointsToScore;
  64.                     }
  65.                 }
  66.                 if (nakovsPoints == 500)
  67.                 {
  68.                     Console.WriteLine("Nakov");
  69.                     Console.WriteLine(rounds);
  70.                     Console.WriteLine(simeonsPoints);
  71.                     return;
  72.                 }
  73.                 pointsToScore = int.Parse(Console.ReadLine());
  74.                 whatHeDone = Console.ReadLine();
  75.                 if (whatHeDone == "success")
  76.                 {
  77.                     if (simeonsPoints + pointsToScore <= 500)
  78.                     {
  79.                         simeonsPoints += pointsToScore;
  80.                     }
  81.                 }
  82.                 playerToStart = "Simeon";
  83.                 if (simeonsPoints == 500)
  84.                 {
  85.                     Console.WriteLine("Simeon");
  86.                     Console.WriteLine(rounds);
  87.                     Console.WriteLine(nakovsPoints);
  88.                     return;
  89.                 }
  90.             }
  91.         }
  92.         if (simeonsPoints == nakovsPoints)
  93.         {
  94.             Console.WriteLine("DRAW");
  95.             Console.WriteLine(simeonsPoints);
  96.         }
  97.         else if (simeonsPoints > nakovsPoints)
  98.         {
  99.             Console.WriteLine("Simeon");
  100.             Console.WriteLine(simeonsPoints - nakovsPoints);
  101.         }
  102.         else
  103.         {
  104.             Console.WriteLine("Nakov");
  105.             Console.WriteLine(nakovsPoints - simeonsPoints);
  106.         }
  107.     }
  108. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement