GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

Wednesday, 20 July 2022

[Solution] Fill The Grid CodeChef Solution



You have a grid with N rows and M columns. You have two types of tiles — one of dimensions 2×2 and the other of dimensions 1×1. You want to cover the grid using these two types of tiles in such a way that:

  • Each cell of the grid is covered by exactly one tile; and
  • The number of 1×1 tiles used is minimized.

Solution Click Below:-  👉CLICK HERE👈
👇👇👇👇👇

Find the minimum number of 1×1 tiles you have to use to fill the grid.

Input Format

  • The first line of input will contain a single integer T, denoting the number of test cases.

  • Each test case consists of a single line containing two space-separated integers N,M.

Output Format

For each test case, print on a new line the minimum number of 1×1 tiles needed to fill the grid.

Constraints

  • 1T104
  • 1N,M104

No comments:

Post a Comment