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

Турниры > IMPC-2014-15 Questions > задача:


1st-6. 50485 - Center of gravity of a plate

IMPC-2014-15 Questions

Старт: 22.ноя.2014 в 15:00:00
Финиш: 22.ноя.2014 в 20:00:00
Турнир завершён!
• Турнирная таблица

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

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

• 0th-1. 50402 - Hello World!
• 0th-2. 50403 - Number of Chairs
• 0th-3. 50763 - Valid Password
• 0th-4. 50404 - Sum of Self Powers
• 0th-5. 50692 - How much money?
• 1st-2. 50483 - Group Total
• 1st-3. 50484 - Number Of Letters
• 1st-4. 50473 - Counting Circles Posit...
• 1st-6. 50485 - Center of gravity...
• 2nd-1. 50522 - Multiplication Table - 2
• 2nd-2. 50512 - Coding redundancy
• 2nd-3. 50533 - Contacts List
• 2nd-5. 50793 - Top M Customers
• 2nd-6. 50486 - Problems and Progr...
• 3rd-2. 50405 - Accounts Receivable
• 3rd-3. 50474 - Sum of Two Primes
• 3rd-4. 50406 - Draw Pattern 178

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

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

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

Center of gravity of a plate

National Science academy, for an experiment, needs to calculate the center of gravity (weight center) of an irregular plate. The plate has tabular format and it has different weights on its every cell (e.g. the left figure).

In physics, center of gravity is the point where relative distributed mass sums to zero.

Center of gravity of a rectangular-irregular shape is the point where the difference between sum of weighted relative positions on the left-right and up-down sides are close to zero.

Assuming that

  • the objects have fixed width (1cm each)
  • all objects are pin-point objects and have their center of gravity in their centers (5mm, 5mm)
For example, if we have the following 5-by-1 rectangular object (right image) with the weights: 2, 3, 1, 1, 3.
Then, the weight center of the series is 2.5cms from the left and 0.5cms from the top. Because
  2*2 + 3*1 + 1*0 = 1*1 + 3*2
and thus sum of weighted relative positions on the left and right sides are equal to zero.

Question: Write a program that is going to read the weights on a rectangular object and decide the center of gravity.

Input specification
There are two numbers (m and n) at the beginning representing height and width of the rectangular object. Each of the following m lines have n-integers numbers where 1 ≤ (m and n) ≤ 1000, and the numbers are between 0 and 100.

Output specification
Show x and y positions of weight center with a 0.01cm precision.

 Sample Input I     Sample Input II   
3 3
1 2 2
1 2 2
4 8 8
4 4
15 22 16 19
14 7 15 10
7 12 4 17
19 2 14 7
 Sample Output I     Sample Output II   
1.7 2 2 1.76


Explanation: You can use the following formula to calculate the centers:

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

www.contester.ru