Олимпиадные задачи по программированию. Ч. 4. Лучшие решения. Ускова О.Ф - 37 стр.

UptoLike

Составители: 

system programming, economics, economical cybernetics,
information systems, information security)
- students not having informatics among major subjects
- students majoring in humanities
- students majoring in the field of art, culture or sport.
The 1
st
year students may optionally move to another section
according to their majoring subject.
1
st
tour tasks
Programming and informational modeling section
Task (common for all nominations)
A passenger arrived at the bus stop at 8 a.m. and stayed there till
8:59 a.m. During that time he wrote down the time of arrival of every
bus. For every particular route buses arrive at the bus stop after the
same interval. It is also known that during the given period of time at
least two buses of every route arrived at the bus stop.
The task is to determine according to the passengers records the
least number of bus routes passing through the given bus stop and
the routes schedule.
Technical requirements.
The number of routes <= 17.
Input data is in the input.txt file of the following format. The fist line
contains a number n <= 300 (the number of buses arrived), the
second one contains a sequence of integers from 0 to 59 denoting
arrival time in minutes.
Output data should be placed into the output.txt file of the following
format. Every line should contain data for one particular root: Time of
arrival of the first bus and interval between bus arrivals. The root
order does not matter. If there are many solutions only one solution
is enough.
Example:
Input.txt Output.txt