Recently I had an interesting interaction on one of my questions. A user posted this answer in C++. My question requires a function on the positive numbers that has some properties, the user's answer essentially implemented the function
add 1, which does not satisfy these properties on the positive integers, however this function does satisfy these properties on a cyclic group, which C++'s
unsigned type is (this actually not define as such in the C++ specification, however almost all implementations do it this way).
Needless to say I have asked the user to delete the answer and the obliged. However this brings me some concern. In order to "fix" their answer it seems that this user would have to implement their own dynamically allocated integer class, which is a big pain to do (believe me I've done it before). It feels to me as if this is overkill, we often allow answers that will occasionally calculate an incorrect, as long as the "algorithm" is correct.
What should I do in this case? Is there a way that answers in languages like C++ can reasonably compete on these types of challenges without "cheating"?