View Single Post
Old 24-02-2005, 08:52 PM   #5
Unknown Hero
Home Sweet Abandonia

 
Join Date: Aug 2004
Location: Split, Croatia
Posts: 1,028
Default

Quote:
Originally posted by NrmMyth+Feb 24 2005, 09:23 PM--></div><table border='0' align='center' width='95%' cellpadding='3' cellspacing='1'><tr><td>QUOTE (NrmMyth @ Feb 24 2005, 09:23 PM)</td></tr><tr><td id='QUOTE'>
Quote:
Originally posted by Unknown Hero@Feb 22 2005, 03:36 PM
<!--QuoteBegin-aaberg
Quote:
@Feb 22 2005, 11:22 AM
Answers in C#

Easy.

EASY?????

Muahahahahahahahahahahah!!! :twisted:

You wont say that after a few months when I arrive at difficult ones! LOL
I see that the Unknown Hero is a good programer.
So could you please solve avion.c from the regional conest 200x.

See you in scool. k: [/b][/quote]
It was an exam from 2002 regional contest in Croatia (now I have to post it :ranting: :ranting: )!!!!

Here's the exam:

Imagine an aeroplane in which there is only one tiny access batween the lines of seats. Imagine passengers that enter and sit on their places.
Every passenger must sit exactly on its seat. Entrance of the aeroplane is on the begining of it. Passengers enter one by one WITHOUT any unnecessary staying and delaying.
Passenger walks trough the lines. He is needed ONE SECOND to pass from one line to another (or more if there is a jam in front of him), and FIVE SECONDS to place his things in the space above his seat. In tiny access batween lines can be only ONE PASSENGER.
Write a program that will calculate how many time is needed for access to be FREE i.e. to all passengers be sitting on their places.

ENTERING PARAMETERS:
In first line of the entering file there is a whole number N (number of passengers) 1<=n<=1000.
In (i+1) line there is a whole number R (number of line in which passenger number i must sit in) 1<=R<=1000.
Passengers are marked with numbers from 1 to N and they enter in aeroplane in that order, and the number of passengers that sit in the same line isn't limited.

EXITING PARAMETERS:
In first and only line of exiting file, you must write a time (in seconds) that is needed for all passengers to sit down.

TEST EXAMPLES:
aero.in
1
3
aero.out
7

aero.in
2
3
3
aero.out
12

aero.in
4
4
4
1
5
aero.out
19

If you have any questions about the exam, just ask. I translated it fro Croatian, so it can have some mistakes.
Unknown Hero is offline                         Send a private message to Unknown Hero
Reply With Quote