HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Chapter 3. Repetition structures > problem:


2. Molecules

Volume problems

• 07. Fibonacci Series
• 08. Binary to decimal
• 09. Decimal to binary
• 10. Maximum
• 11. Perfect numbers
• 12. Wonder primes
• 13. Round numbers
• 14. Tower of Happiness
• 2. Molecules
• The power of 2

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 1000/1000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.

Calculate the mass of a molecule. A molecule is a chemical structure that is made up of more then one atom. H2O is the molecule of water. It contains two hydrogen and one oxygen atoms. The weight of hydrogen is 1, and the weight of oxygen is 16. Thus the weight of water molecule is 2*1 + 16*1 = 18.

The first line of the input contains an integer (N) that denotes the number of the atoms in the molecule. Each of the following N lines denotes an atom of the molecule with two integers. The first integer is the mass of the atom, and the second integer is the quantity of the atom.

cin cout
2
1 2
16 1
18
4
1 2
5 3
2 4
10 3
55
Для отправки решений необходимо выполнить вход.

www.contester.ru