Tag: Codechef

  • Finding Shoes Codechef Python Solution

    Finding Shoes Codechef Python Solution

     Finding Shoes Codechef Python Solution

    Problem

    Chef has N friends. Chef promised that he would gift a pair of shoes (consisting of one left shoe and one right shoe) to each of his N friends. Chef was about to go to the marketplace to buy shoes, but he suddenly remembers that he already had M left shoes.
    What is the minimum number of extra shoes that Chef will have to buy to ensure that he is able to gift a pair of shoes to each of his N friends?
    For example, if N = 2, M=4, then Chef already has 44 left shoes, so he must buy 2 extra right shoes to form 2 pairs of shoes.
    Therefore Chef must buy at least 2 extra shoes to ensure that he is able to get N=2 pairs of shoes.

    Input Format

    • The first line contains a single integer T – the number of test cases. Then the test cases follow.
    • The first line of each test case contains two integers N and M – the number of Chef’s friends and the number of left shoes Chef has.

     

    Output Format

    For each test case, output the minimum number of extra shoes that Chef will have to buy to ensure that he is able to get N pairs of shoes.

    Finding Shoes Solution in Python

     

    For More Python Questions and Solutions : Click Here

    Python Roadmap for Beginners

    10 Most-Recommended Books for Software Developers

  • Score High Codechef Python Solution

    Score High Codechef Python Solution

    Chef is taking a tough examination. The question paper consists of  objective problems and each problem has  options  and , out of which, exactly one option is correct.

    Since Chef did not study for the exam, he does not know the answer to any of the problems. Chef was looking nearby for help when his friend somehow communicated the following information:

    • Exactly  problems have option  as the answer.
    • Exactly  problems have option  as the answer.
    • Exactly  problems have option
    • Exactly  problems have option  as the answer.

    Note that:

    • Each problem is worth exactly  mark and there is no negative marking.
    • Even though Chef knows the number of correct options of each type, he does not know the correct answer to any problem.

    Based on the given information, find the maximum marks Chef can guarantee if he marks the answers optimally

    Input Format

    • First line will contain , number of test cases. Then the test cases follow.
    • First line of each test case contains an integer  denoting the number of problems.
    • Second line of each test case contains  integers  and  – as mentioned in the problem statement.

    Score High Codechef Python Solution

    Code Solution

  • Apples and Oranges Codechef Today Solution in Python

    Apples and Oranges Codechef Today Solution in Python

    Bob has XX rupees and goes to a market. The cost of apples is Rs. AA per kg and the cost of oranges is Rs. BB per kg.

    Determine whether he can buy at least 11 kg each of apples and oranges.

    Input Format

    • The first line of input will contain an integer XX, the amount of money Bob has.
    • The second line of input contains two space-separated integers AA and BB, the cost per kg of apples and oranges respectively.

    Output Format

    Print a single line containing Yes if Bob can buy the fruits and No otherwise.

    You may print each character of the string in uppercase or lowercase (for example, the strings yesYesyEs, and YES will all be treated as identical).

    Click Here To Get Solution

    Python Roadmap for Beginners