Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Linq;
- namespace P2._TheLift
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- int peopleWaiting = int.Parse(Console.ReadLine());
- int[] lift = Console.ReadLine()
- .Split(' ')
- .Select(int.Parse)
- .ToArray();
- for (int i = 0; i < lift.Length; i++)
- {
- for (int k = lift[i]; k < 4; k++)
- {
- if (peopleWaiting == 0 && lift[i] < 4)
- {
- Console.WriteLine($"The lift has empty spots!\n{string.Join(" ", lift)}");
- }
- if (lift[i] == 4)
- {
- break;
- }
- lift[i]++;
- peopleWaiting--;
- }
- }
- if (peopleWaiting == 0)
- {
- Console.WriteLine(string.Join(" ", lift));
- }
- if (peopleWaiting > 0)
- {
- Console.WriteLine($"There isn't enough space! {peopleWaiting} people in a queue!\n{string.Join(" ",lift)}");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement