Published August 24, 2022 by

Odd Pairs Codechef code Java (ODDPAIRS)

Problem

  • Given an integer NN, determine the number of pairs (A, B)(A,B) such that:
  • 1<=A,B<=N
  • A + B is odd.

Input Format

  • The first line of input will contain a single integer TT, denoting the number of test cases.
  • Each test case consists of a single integer NN.

Output Format

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

Constraints

  • 1<=T<=100
  • 1<=N<=10^9

Input

  • 5
  • 1
  • 2
  • 3
  • 100
  • 199

Output

  • 0
  • 2
  • 4
  • 5000
  • 19800

Read More
Published August 24, 2022 by

Weights Codechef code Java ,(WGHTS)

Problem

  • Chef is playing with weights. He has an object weighing WW units. He also has three weights each of X, Y,X,Y, and ZZ units respectively. Help him determine whether he can measure the exact weight of the object with one or more of these weights.
  • If it is possible to measure the weight of object with one or more of these weights, print YES, otherwise print NO.

Input Format

  • The first line of input will contain a single integer TT, denoting the number of test cases.
  • Each test case consists of single line containing a four positive integers W, X, Y,W,X,Y, and ZZ.

Output Format

  • For each test case, output on a new line YES if it is possible to measure the weight of object with one or more of these weights, otherwise print NO.
  • You may print each character of the string in either uppercase or lowercase (for example, the strings yes, YES, Yes, and yeS will all be treated as identical).

Constraints

1<= T <=10000

1<=W,X,Y,Z<=100000





Click Copy code Snippet below

Read More
Published August 24, 2022 by

Greater Average Codechef Java Code, (AVGPROBLEM)

Problem

You are given 3 numbers A, B, and C.

Determine whether the average of A and B is strictly greater than C or not?

NOTE: Average of A and B is defined as \frac{(A+B)}{2}. For example, average of 5 and 9 is 7, average of 5 and 8 is 6.5.

Input Format

  • The first line of input will contain a single integer TT, denoting the number of test cases.
  • Each test case consists of 33 integers A, B,A,B, and CC.

Output Format

  • For each test case, output YES if average of AA and BB is strictly greater than CC, NO otherwise.
  • You may print each character of the string in uppercase or lowercase (for example, the strings YeS, yEs, yes and YES will all be treated as identical).


Constraints

1<= T <=1000

1<=A,B,C<=10


Read More
Published August 24, 2022 by

Car Trip Code chef, Solution Java (CARTRIP)

Problem

  • The chef rented a car for a day.
  • Usually, the cost of the car is Rs 1010 per km. However, since Chef has booked the car for the whole day, he needs to pay for at least 300300 kms even if the car runs less than 300300 kms.
  • If the car ran XX kms, determine the cost Chef needs to pay.


Input Format

  • The first line of input will contain a single integer TT, denoting the number of test cases.
  • Each test case consists of a single integer XX - denoting the number of kms Chef travelled.

Output Format

  • For each test case, output the cost Chef needs to pay.


Constraints

1<= T <=100

1<=X<=1000


 Click Copy code Snippet below
Read More
Published August 13, 2022 by

Make A and B equal CodeChef - Java Code EQUALISE

 Make A and B equal CodeChef Java Code EQUALISE

Problem Code: EQUALISE


Problem:

  • Chef has two numbers AA and BB.
  • In one operation, Chef can choose either AA or BB and multiply it by 22.
  • Determine whether he can make both AA and BB equal after any number (possibly, zero) of moves.


Input Format:

  • The first line of input will contain a single integer TT, denoting the number of test cases.
  • Each test case consists of two space-separated integers AA and BB.

Output Format:

  • For each test case, output YES if Chef can make both numbers equal, NO otherwise.
  • Note that the checker is case-insensitive i.e. YES, Yes, yes, yES are all considered same.






Constraints:
  • 1<=T<=2500
  • 1<=A,B<=50
INPUTS: 
  • 4
  • 5 20
  • 6 6
  • 12 2
  • 50 20






OUTPUT:
  • YES
  • YES
  • NO
  • NO
Explanation:
  • Test case 1: The chef can multiply AA by 22 twice and both AA and BB will become 2020.
  • Test case 2: Both numbers are already equal.
  • Test case 3: It can be shown that AA and BB cannot be made equal.
  • Test case 4: It can be shown that AA and BB cannot be made equal.





Make A and B equal CodeChef Java Code EQUALISE



For more related, Codechef, Search the keyword in Search Bar






Thank You


Read More