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

Разделы > Linear Data Structures: Arrays > задача:


ECE - Question 1

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

• 50925 - Optimizing Elevator Usage
• 50269 - Matrix Determinant
• 50988 - Laplacian Filter
• 50986 - The Oldest Person
• 51173 Question 5
• 50873 - Max Frequency
• 51009 - Sum of the nth row
• 51107 - Factorial
• ECE - Question 1
• CEN - Question 1
• Reflektimi i pikes
• 50972 - Division
• 51135 - Class Average 1
• 51136 - Class Average 2
• 51094 - Passing the course
• Question 1
• 51069 - Last Digit of a Fibonacci Nu...

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

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

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

51205 ECE - Question 1

You work for a company which mainly trades with 3 other companies. You record your balance in a file (you can still use cin or scanf to read or if you want you can read from "input.txt" file) with the following convention:

  1. Debit of Company A
  2. Credit of Company A
  3. Debit of Company B
  4. Credit of Company B
  5. Debit of Company C
  6. Credit of Company C

Question: Write a program that is going to read debit/credit information for 3 companies. Then, it will find out for the following:

  1. Total debts,
  2. Total credits
  3. The most debited company according to the balance

Input specification
You will be given an integer (n) the number of transactions where 0 ≤ n ≤ 2000. Then, in each of the following n lines you will be given 2 numbers :

  • Operation Code: an integer from 1 to 6 (where 1 means Debit of Company A, etc.)
  • The amount: a floating point number which is between 0 and one million

Output specification
Show the following information (floating point numbers with 2 digits precision):

  • Total debts,
  • Total credits
  • The most debited company: a char of (A or B or C)

Sample Input I
6
2 59
6 154
2 187
5 497
5 31.5
3 488
Sample Output I
1016.5 400 B

Explanation: The balance according to given information is:

Company Total Balance
A Debit 0 246
Credit 246
B Debit 488 -488
Credit 0
C Debit 528.5 -374.5
Credit 154
Then, the most debited company is B.
Для отправки решений необходимо выполнить вход.

www.contester.ru