HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Data Structures > problem:


50677 - The Cottage

Guest
• Review clarifications (2)

Volume problems

• 50367 - Bar Codes
• 50549 - k-Nearest Neighbours (kNN)
• 50697 - Base Stations
• 50479 - Bit Compressor
• 50383 - Noisy Mornings
• 50486 - Problems and Programmers
• 50695 - Longest link between neurons
• 50677 - The Cottage
• 50414 - Traffic
• 50698 - Ayran Delivery
• 50700 - Candidates for the Mayor
• 50415 - The Scientist
• 50830 - Sorting BST Nodes
• 50803 - Sum of the depths in BST
• 50805 - Sum of the weights in a BST
• 50712 - Moon algebra

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
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