3 ms·
I find it hilarious that three people thought to return the highest possible number by underflowing unsigned ints (that are being treated as arbitrarily large i
by tel 16y ago
I find it hilarious that three people thought to return the highest possible number by underflowing unsigned ints (that are being treated as arbitrarily large ints). It's a funny hack even if it doesn't teach you anything like Loader's does.
- amalcon 16y agoMy first thought was along those lines: (int)((unsigned int)-1 >> 1)==INT_MAX
- mseebach 16y agoI don't see how that is relevant when the problem assumes an arbitrarily large int-type. It's trivial to return the largest possible value (INT_MAX) for any fixed-size int-type, but a such does not exist. Basically, many posters are missing the point that it's a mathematics challenge, not a C-challenge, which is excusable since it's posted in a C-group.
- tel 16y agoExactly, which I find hilarious.