GUPTA MECHANICAL

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

Friday 8 July 2022

[Solution] Slow Solution CodeChef Solution | Codechef Solution 2022


Chef is trying to solve a problem having T test cases, where, for each test case he is given a single integer N.

Chef has an algorithm which takes exactly N2 iterations for a test case with value N.

The constraints of the problem are as follows:

  • 1TmaxT
  • 1NmaxN
  • Sum of N over all test cases does not exceed sumN.

Given the values maxT,maxN, and sumN, determine the maximum number of iterations Chef's algorithm can take for any valid input file satisfying all the constraints.

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

Formally speaking, find the maximum value of N12+N22++NT2 for any valid input file satisfying all the constraints.

Input Format

  • The first line of input will contain a single integer T, denoting the number of test cases.
  • Each test case consists of single line consisting of three integers maxT,maxN, and sumN.


Output Format

For each test case, output the the maximum number of iterations Chef's algorithm can take in any valid test file.

Constraints

  • 1T1000

No comments:

Post a Comment