[Solution] Gold Mining solution codechef

CodeChef Starters 15 Division 3 (Rated) - CodeChef

Gold Mining solution codechef

Chef has decided to go to a gold mine along with N of his friends (thus, total N+1 people including Chef go to the gold mine).

The gold mine contains a total of X kg of gold. Every person has the capacity of carrying up atmost Y kg of gold.

Will Chef and his friends together be able to carry up all the gold from the gold mine assuming that they can go to the mine exactly once.

Gold Mining solution codechef Input Format

  • First line will contain T, number of testcases. Then the testcases follow.
  • Each testcase contains of a single line of input, three integers N,X,Y.

Output Format

For each testcase, output "YES" if you and your friends can carry all the gold, otherwise output "NO".

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).

Gold Mining solution codechef Constraints

  • 1T1000
  • 1N,X,Y1000

Gold Mining solution codechef Sample Input 1

2 10 3
2 10 4
1 5 10

Sample Output 1


Gold Mining solution codechef Explanation

Test Case 1: You along with your friends can only carry a maximum of 9(3×3)kg of gold.

Test Case 2: It is possible to carry all the gold from the mine. You can carry 4 kg of gold and your both friends carry 3 kg of gold each, thus carrying the whole 10kg of gold.

Updating Soon…

Gold Mining solution codechef

Counting Tuples codechef solution


Leave a Comment