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

Турниры > CEN109/111_2016_Questions > задача:


RE2. 51078 - Max trade

CEN109/111_2016_Questions

Старт: 07.дек.2016 в 12:37:00
Финиш: 07.дек.2016 в 13:42:00
Турнир завершён!
• Турнирная таблица

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

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

• PE06. 51032 - Triangle Property
• PE07. 51033 - Sum of the series
• PE08. 51034 - Area of 3 Shapes
• PE09. 51040 - Annual profit
• PE10. 51041 - Plane Segmentation
• PE11. 51038 - Simple interest
• PE12. 51039 - Automated billing system
• RE1. 51077 - Grades Histogram
• RE2. 51078 - Max trade
• hw3. 51057 - Number of students
• hw4. 51058 - Third grade students
• hw5. 51059 - Football teams
• hw6. 51060 - Public Transportation

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

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

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

Max trade

Question A company stores its trade information in a file. Every line represents information for one company. In the file, positive numbers represent the amount that you have deposited (put in) and negative numbers represent the amount that have credited (taken). Write a program that will take information for n companies. And it will show the id (order) of the company with which you have the biggest trade (sum of your deposits and credits) and amount of the smallest credit that you have taken (from any company).

Input specification: You will be first given an integer (n where n is between 1 and 2000): the number of companies. Then, you will be given n lines of information. Each line may contain up to 2,000 positive or negative floating point numbers (±108) separated by commas and ending with a semicolon.

Output specification: Show two information: 1) the id (order) of the company with which you have the biggest trade and 2) the smallest credit to you.

Sample Input
4
3.2, 23, -7, -13.2;
3, 5, 8.5;
3, -7.5, -3.1;
-15, 5, 3;
Sample Output
1 3.1

Explanation: Total trade of companies:

Order Deposits Credits Total
1 26.2 20.2 46.4
2 16.5 0 16.5
3 3 10.6 13.6
4 8 15 23
The total trade of the first company is 46.4 which is the biggest. So, the company with the biggest trade is 1. (if there are many companies with the same max value, show any). And the smallest amount of credit is 3.1.


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

www.contester.ru