GHOME - Editorial

#GHOME - Editorial

PROBLEM LINK:

Practice
Contest

Author: Shivam Chauhan
Tester: Shivam Chauhan
Editorialist: Shivam Chauhan

DIFFICULTY:

SIMPLE

PROBLEM:

The problem states that we have to cover a mn sq. units of floor with 21 sq. units of tile. How many
tiles we need to do so?

QUICK EXPLANATION:

Simple, we can find the number of tiles needed by diving the total area of floor by area of one tile.

EXPLANATION:

By using some high school mathematics, we can find out that number of tiles are total area of floor
divided by total area of one tile. Now total area of floor is mn sq. units and total area of one tile is 21
sq units or simply 2 sq. units. Now the formula generalizes to (mn)/2. But as the output should be an
integer and there are many possibilites when (m
n) becomes odd thus resulting to an additional 0.5 to
the answer we need to take ceil of it. The best way to take ceil is to simply add 1 to (mn) and the divide
by 2 like this, (m
n+1)/2.

SOLUTIONS:

Setter's Solution

#include

using namespace std;

#define ll long long int

int main()

{

ll a,b;

cin>>a>>b;

cout<<(a*b+1)/2<<endl;

}