luogu#P1994. 有机物燃烧
有机物燃烧
Background
I originally planned to make it harder, but never mind.
Problem Description
Given an organic compound containing only elements, output the coefficients of and in the balanced chemical equation for its reaction with oxygen.
Input Format
One line, a string representing the organic compound.
Output Format
Two numbers, which are the coefficients of and , respectively.
C2H5OH
2 3
Hint
Sample explanation:
$$\mathrm{C_2H_5OH + 3 O_2 \xlongequal{\text{点燃}} 2 CO_2 + 3 H_2O}$$For of the testdata:
- The string length does not exceed .
- The coefficients of and to be found do not exceed .
- The given organic compound is valid and contains only elements.
Translated by ChatGPT 5