It's not a fallacy. I know what you're thinking of, but I don't know what the term for it is either. I vaguely remember a math teacher telling me this back in 8th grade when I got the right result for an algebra equation but I used the wrong process to get there. I didn't get credit for the answer being right and I thought it was unfair.
I hated that math teacher. She was the worst.