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

Сборники > Фёдор Меньшиков. Тренировки > задача:


003. 50387 - Passengers in the Train

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

Задачи сборника

• 50867 - Average of the Best Grades
• Reflektimi i pikes
• 50994 - The Most Crowded Station
• 51194 - The difference between max...
• 001. 50385 - From m to n
• 002. 50365 - Sum of the numbers f...
• 002. 50452 - Multiplication Table
• 002. 50554 - Fuqia e n-t e m (2)
• 003. 50387 - Passengers in the ...
• 003. 50358 - Series of Odd Numbers
• 004. 50424 - Area
• 004. 50522 - Multiplication Table - 2
• 005. 50297 - Divisible By Five
• 006. 50293 - Sum of odd numbers f...
• 007. 50401 - Sum of Odd Numbers
• 009. 50783 - Numri me i vogel
• 010. 50782 - Max of N integers

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

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

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

Passengers in the Train

Shqip

A train leaves the first station with N passengers and visits K stations before it arrives at the last station. In each station some passengers get off the train and others get on the train. All the people in the train get off at the last station.

question:
Make a program that calculates how many passengers get off the train at the last station.

Input specification:
The first line of the input has two integers K and N where 0 ≤ (K and N) ≤ 1000. Each of the following K lines contain two integers (between 0 and 1000), the first one denotes the number of passengers who get off and the second one denotes the number of passengers get on the train at that station.

Output specification:
The output should hava a single integer that is number of passengers who get off the train at the last station.

Sample Input I
5 10
10 17
15 6
6 6
8 10
5 2
Sample Input II
8 4
3 7
8 6
4 2
1 3
4 5
4 5
8 6
6 5
Sample Output I
7
Sample Output I
5


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

www.contester.ru