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

Разделы > Поиск > задача:


51078 - Max trade

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

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

• 50999 - Overlapping Trips
• 50507 - Sequential Numbers
• 50501 - The Highest Average
• 50434 - Row Min Subtraction
• 50980 - The smallest rectangle
• 50860 - Number of Student Certificates
• 50832 - Rock Paper Scissors Lizard ...
• 50834 - The train which leaves the f...
• 51078 - Max trade
• 51056 - Welcome Picnic
• 51055 - The competition
• 51077 - Grades Histogram
• 51057 - Number of students
• 51046 - The biggest number
• 50535 - Image Compression
• 50450 - Last Appereance of a Number
• 50457 - The Number of Winners

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

Если у вас есть предложения или пожелания по работе 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