GUPTA MECHANICAL

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

Wednesday 24 August 2022

[Solution] Odd Pairs CodeChef Solution 2022 | Solution CodeChef



Problem

Given an integer N, determine the number of pairs (A, B) such that:

  • 1 \leq A, B \leq N;
  • A + B is odd.

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 integer N.

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

Output Format

For each test case, output the number of required pairs.


Explanation:

Test case 1: There are no pairs satisfying the given conditions.

Test case 2: The pairs satisfying both conditions are: (1, 2) and (2, 1).

Test case 3: The pairs satisfying both conditions are: (1, 2), (2, 1), (2, 3), and (3, 2).

No comments:

Post a Comment