По договоренности
Building H2O.
- Read N and M from 'molecules.txt'
- Create N Threads Hydrogen that generates H molecules.
- Create M Threads Oxygen that generates O molecules.
- Create 1 Thread Water that waits until 2 Hydrogens and 1 Oxygen is generated and creates one molecule of Water.
- Print to 'water.txt' :
first line: number of water molecules generated.
second line: number of Hydrogen molecules remained.
third line: number of Oxygen molecules remained.
Condition: use Condition Variables to synchronize water generation process