HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Repetition (Loops) > problem:


51078 - Max trade

Guest
• Review clarifications (1)

Volume problems

• 50957 - Divisible by 3
• 51115 - Pascal Triangle
• 50898 - Draw the Pattern
• 51116 - The Star Triangle
• 50896 - Sum of Even Numbers
• 50815 - Breaking the Bunker
• 50899 - How Many Years
• 50806 - TVSH
• 51078 - Max trade
• 50820 - Post Office
• 50807 - Euro to Leke
• 50810 - Print Office
• 50952 - Derby Tirana
• 50871 - Harmonic Mean
• 50859 - Low performance
• 50508 - The Biggest Area
• 51077 - Grades Histogram

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 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