Getting wrong answer in this https://codeforces.com/problemset/problem/1/A

for the above question, I am getting the correct answer…
in the solution set, they took n,m, a as double and then the answer is coming correct.
anyone help me out with this

#include
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define endl “\n”
#define input for(int i=0;i<n;i++)cin>>arr[i];
typedef long long int ll;

using namespace std;

int main() {

ll n,m,a;
cin>>n>>m>>a;
ll num = ceil(n/a)*ceil(m/a);
cout<<num;
return 0;

}

Instead of ceil (\frac{n}{a}), try to do (\frac{n+a-1}{a})
Ceil function may cause division overflow

can you please help me over like from where this is coming : (n+a-1/a)

It’s a standard way of accurately calculating the ceil function.

What is division?
When you divide n by a, n=aq+r where q is quotient and r is remainder. Integer division in c++ gives the quotient and modulo gives the remainder.

How do we find floor function?
When you want floor function, you need q, so \frac{n}{a} works directly.

How to find ceiling function?
When you want ceiling, you need q if r=0, otherwise q+1 (actually you can implement this sentence and that will work as well)
Now, to get q at r=0 and q+1 if r is from 1 to a-1, we add a-1 to numerator and then divide.
If r=0, then this would still give same quotient, otherwise it will increase it by 1.