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 _4_3_14_BoatSimulator
- {
- class Program
- {
- static void Main(string[] args)
- {
- char boat1 = char.Parse(Console.ReadLine());
- char boat2 = char.Parse(Console.ReadLine());
- int strNum = int.Parse(Console.ReadLine());
- int score1 = 0;
- int score2 = 0;
- char winner = ' ';
- for (int i = 1; i <= strNum; i++)
- {
- string speed = Console.ReadLine();
- if (speed == "UPGRADE")
- {
- boat1 += (char)3;
- boat2 += (char)3;
- }
- if (i % 2 == 0)
- {
- if (i == strNum && score2 > score1)
- {
- winner = boat2;
- break;
- }
- else if (score2 >= 50)
- {
- winner = boat2;
- break;
- }
- else
- {
- score2 = score2 + speed.Length;
- }
- }
- else
- {
- if ((i == strNum) && (score1 > score2))
- {
- winner = boat1;
- break;
- }
- else if (score1 >= 50)
- {
- winner = boat1;
- break;
- }
- else
- {
- score1 = score1 + speed.Length;
- }
- }
- }
- Console.WriteLine(winner);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment