Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace _02._Car_Race
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- List<int> list = Console.ReadLine().
- Split(" ", StringSplitOptions.RemoveEmptyEntries).
- Select(int.Parse).ToList();
- int raselenght = list.Count / 2;
- double left = 0;
- double right = 0;
- for (int l = 0; l < raselenght; l++)
- {
- if (list[l] != 0)
- {
- left += list[l];
- }
- else
- {
- left *= 0.8;
- }
- }
- for (int r = list.Count-1; r > raselenght; r--)
- {
- if (list[r] != 0)
- {
- right += list[r];
- }
- else
- {
- right*= 0.8;
- }
- }
- if (left < right)
- {
- Console.WriteLine($"The winner is left with total time: {left}");
- }
- else if (right < left)
- {
- Console.WriteLine($"The winner is right with total time: {right}");
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment