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.
Для отправки решений необходимо выполнить вход.
|