Organic Compounds (rules)


#1

can someone explain why in the fifth test the compound is valid?

CH2(2)CH0(1)CH1(2)CH0(1)CH3
(1) (1)
CH0 CH1(1)CH2(1)CH3
(3) (1)
CH1 CH3

The very first hydrocarbon has 5 bonds!?!?!? :thinking::roll_eyes:


#2

That’s 5 lines of input, not 5 bonds.

The very first carbon CH2(2) has 4 bonds. 2 bonds with 2 individual H and 2 bonds with the neighboring carbon CH0.

All carbons have 4 bonds … unless … we are going into detail that isn’t necessary for solving this problem.


#3

Doesn’t the first bond on line 2 means that there’s a bond between the first HC in line 1 and the first HC in line 3? If it’s so, the first C in line 1 would have 5 Hs (2 from itself, 2 from the next HC on line 1 and 1 from the first HC on line 3).

Sorry, can’t insert an image to explain.

Thank you for the attention.


#4

You might be ignoring empty spaces.

There’s some empty space before the first (1) on line 2 for example. With that the bond ends up right where it belongs.

Bond #1 on line 2 is between CH0 on 1st line and CH0 on line 3.

One detail you might be confused by is the really stupid CH0 notation. It should have been C on its own and not CH0 or CFe0Mg0Cl0H0Al0Na0Se0Si0

So where you see H0 ignore it, it stands for zero hydrogen atoms.


#5

Oh, my… Youre tottaly correct and Im an idiot. I was stripping my input lines. I did it in the beginning, before undestanding that spaces are important for the problem.

Again, thank you very much for your help.

Mauro Crispim