The answer to the input `10`

^{9} is `4243218150`

.

This number needs 32 bits to represent the magnitude alone. So, in sign-magnitude form, it needs at least 33 bits.

The `int`

datatype is signed 32-bit representation. It uses only 31 bits to represent magnitude. Your program would have passed, if you used `unsigned int`

.

Now, it may amuse you that `long`

and `int`

are usually 32-bit long here. To get 64-bit numbers, you need to use `long long`

(for signed) and `unsigned long long`

(for unsigned).

the reasoon why your program got accepted is not because you used `long`

. But, it is because you used `unsigned`

.

answered
**25 Sep '13, 08:04**

2★tijoforyou

4.2k●5●23●64

accept rate:
15%