ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Динамическое программирование > задача:


50677 - The Cottage

Гость
• Вопросы к жюри (2)

Задачи раздела

• 50672 - Math and Soldiers
• 50677 - The Cottage
• 50679 - Jetpack Hurdle Jumping
• 50673 - DNA Testing
• 50485 - Center of gravity of a plate
• 51062 - Fish Pond II
• 50997 - Dynamic Knights
• 51010 - Max Sequential Sum
• 50936 - Saving the Soldiers
• 51072 - Castle on chessboard

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Osman Ay.

The Cottage

Question:
Residents of Ankara go to the mountains in the sweltering days of summer. Mr. Moneysayar has a cottage at the mountains of Ankara. He rents his cottage to make money. The rental fee of the cottage is depending of the number of the rental days; ₺100 per day. Mr. Moneysayar has a list of the requests (starting and ending days) for the next twelve months. Make a program that calculates maximum amount of money Mr. Moneysayar can make for the next twelve months.

Input specification
The first line of the input contains a single integer N (1 ≤ N ≤ 1000) that is the number of the requests. Each of the following N lines denotes a request with two integers: a and b (0 ≤ a < b < 365) where, a is the starting day and b is the ending day and start and end days are included in the rent. One customer can check in the cottage only after the ending day of the previous customer.

Output specification
The output contains a single integer that is the maximum money that Mr. Moneysayar can make.

 Sample Input I     Sample Output I   
 5
 5 6
 1 3
 4 7
 7 9
 2 5
 800

Output specification
If the days 1-3, 5-6, and 7-9 are taken it makes ₺800


Для отправки решений необходимо выполнить вход.

www.contester.ru