well i tried this it don't work with ceil in c++
int n, m, a;
double r1, r2;
cin >> n;
cin >> m;
cin >> a;
r1 = (n/a);
r2 = (m/a);
cout << (ceil(r1)*ceil(r2));
the n/a operation shall return a double in case of n = 3 and a =2 but it doesn't
also..
the m/a operation shall return a double in case of m = 3 and a =2 but it doesn't
Here is the problem,
n/a
and m/a
will evaluate to integers since n,m,a are integers and the integer will get stored into double , to avoid this you can type cast like this
r1=(double)n/a;
r2=(double)n/a;
Or simply change the data type of a from int to double, maybe (It will help you to #A. Theatre Square)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With