64-bit integers and printf
/scanf
Information for C users: input and output of 64-bit integers is slightly different between Windows and Linux.
On Linux (in particular, on the grading server) GCC uses the implemantations of printf
and scanf
from the GNU library glibc
where the format string for 64-bit signed integers (long long
) is %Ld
or %lld
and the format string for 64-bit unsigned integers (unsigned long long
) is %Lu
or %llu
.
On Windows (in many computer labs) both MSVC (the compiler of Visual Studio) and GCC/MinGW (the default compiler of Code::Blocks) use the implementations of printf
and scanf
from the Microsoft library MSVCRT.DLL
where the format string for 64-bit signed integers is %I64d
or %lld
and the format string for 64-bit unsigned integers is %I64u
or %llu
.
For your solution to work correctly in both environments, it's best to always use %lld
and %llu
.
This applies also to using printf
and scanf
in C++ code, but does not affect the use of the streams
library in C++ (the cin
, cout
, and cerr
objects and the ifstream
and ofstream
classes).
The input and output operations of Pascal, Java, and Python have no difference between Windows and Linux.