I wrote this snippet code as a solution for a problem but in a test case that tries big numbers as input(for example 10000000000 10000000000 1), a weird output comes out.it's work for integer range number but how can I handle code for big numbers?
here's the condition: (1 ≤ n, m, a ≤ 10^9).
#include<stdio.h>
int main()
{
int m, n, a;
int count = 1;
scanf("%d%d%d",&m,&n,&a);
if (m%a != 0) {
count *= ((m/a)+1);
}
else {
count *= (m/a);
}
if (n%a != 0) {
count *= ((n/a)+1);
} else {
count *= (n/a);
}
printf("%d",count);
return 0;
}
you can see the problem here
ps 1: my compiler is GNU GCC 5.1.0.
ps 2: I submit it to website compiler so can't install any foreign library.