You can do a factor labelling analysis whenever you go from extensive variable to extensive variable (extensive variable is proportional to the amount of stufff - mass)
Start with what you know and cancel units to get to what you want:
1 km (kJ/km)(kJ from G/kJ needed)(g G/kJ from G)(g Cereal/g G) = grams Cereal
Note all per cents can be taken care of as they are only ratios.
248 kJ/ 1km, 100 kJ/30 kJ, 1g/15.7 J, 100 g C/40 g G