Provided they are all gases then the formula is going to be 

they key here is that 1 mole of any ideal gass occupies the same volume as 1 mole of any other ideal gas under the same conditions of temperature and pressure. So, since the same volume of any ideal gas has the same number of moles then you can treat the ratio of volumes as the ratio of moles. 

the ratio of volumes is 
10 : 40 : 50 
1 : 4 : 5 

all the Carbon from the hydrocarbon is in the CO2 
10 ml of hydrocarbon produces 40 ml CO2, 
1 : 4 ratio 
So 1 mole hydrocarbon has 4 moles Carbon 

All the H ends up in the water 
10 ml hydrocarbon produces 50 ml water, 
1 : 5 ratio, 
but also each water has 2 H atoms 
So 1 mole hydrocarbon has 10 moles Hydrogen 

which gives 
3 5 3