int f(int n) /* Treats numbers in the range 0XC0000000 to 0X3FFFFFFF as valid to
generate f(f(x)) equal to -x. If n is within this range, it will
project n outside the range. If n is outside the range, it will
return the opposite of the number whose image is n. */
{
return n ? n > 0 ? n <= 0X3FFFFFFF ? 0X3FFFFFFF + n : 0X3FFFFFFF - n :\
n >= 0XC0000000 ? 0XC0000000 + n : 0XC0000000 - n : 0;
}
int main()
{
int n = 5;
printf( "f(f(%d)) = %d\n", n
, f
(f
(n
)) ); return 0;
}
aW50IGYoaW50IG4pIC8qIFRyZWF0cyBudW1iZXJzIGluIHRoZSByYW5nZSAwWEMwMDAwMDAwIHRvIDBYM0ZGRkZGRkYgYXMgdmFsaWQgdG8KICAgICAgICAgICAgICAgIGdlbmVyYXRlIGYoZih4KSkgZXF1YWwgdG8gLXguIElmIG4gaXMgd2l0aGluIHRoaXMgcmFuZ2UsIGl0IHdpbGwKICAgICAgICAgICAgICAgIHByb2plY3QgbiBvdXRzaWRlIHRoZSByYW5nZS4gSWYgbiBpcyBvdXRzaWRlIHRoZSByYW5nZSwgaXQgd2lsbAogICAgICAgICAgICAgICAgcmV0dXJuIHRoZSBvcHBvc2l0ZSBvZiB0aGUgbnVtYmVyIHdob3NlIGltYWdlIGlzIG4uICovCnsKICAgIHJldHVybiBuID8gbiA+IDAgPyBuIDw9IDBYM0ZGRkZGRkYgPyAwWDNGRkZGRkZGICsgbiA6IDBYM0ZGRkZGRkYgLSBuIDpcCiAgICAgICAgICAgbiA+PSAwWEMwMDAwMDAwID8gMFhDMDAwMDAwMCArIG4gOiAwWEMwMDAwMDAwIC0gbiA6IDA7Cn0KCmludCBtYWluKCkKewogICAgaW50IG4gPSA1OwogICAgcHJpbnRmKCAiZihmKCVkKSkgPSAlZFxuIiwgbiwgZihmKG4pKSApOwogICAgcmV0dXJuIDA7Cn0K