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

Турниры > Epoka Science Olympiad 2016 > задача:


9-2. 50958 - Number of Passengers in Train

Epoka Science Olympiad 2016

Старт: 11.апр.2016 в 14:07:57
Финиш: 24.апр.2016 в 05:00:00
Турнир завершён!
• Турнирная таблица

Задачи турнира

• 8-3. 50952 - Print All Numbers from...
• 8-4. 50953 - ASCII Codes - Reverse
• 8-5. 50974 - Area of the circle
• 8-P2. 50892 - Even Numbers
• 8-P3. 50893 - Print All Numbers
• 8-P4. 50894 - ASCII Codes
• 8-P5. 50895 - Hours Minutes and Se...
• 9-1. 50957 - Divisible by 3
• 9-2. 50958 - Number of Passen...
• 9-3. 50959 - Draw the Pattern
• 9-4. 50960 - Number of Heart Beats
• 9-5. 50961 - Order of 3 Runner
• 9-P1. 50896 - Sum of Even Numbers
• 9-P2. 50897 - Prime Number
• 9-P3. 50898 - Draw the Pattern
• 9-P5. 50900 - Put the Numbers in D...

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

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

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

Number of Passengers in Train

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 got off the train and some passengers got on the train. Everybody in the train got off at the last station.

 

Make a program that calculates how many passengers got off the train at the last station.

 

Input:

The first line of the input has two integers K and N.

Each of the following K lines contains two integers, the first one denotes the number of passengers who got off the train at that station, and the second one denotes the number of passengers got on the train at that station.

 

Output:

The output should have a single integer that is number of passengers who got off the train at the last station.

Sample Input1:

Sample Input2:

2 5

3 6

2 4

5 20

6 15

5 30

20 12

15 8

6 7

Sample Output1:

Sample Output2:

10

40

 

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

www.contester.ru