Posts

SMALLEST NUMBER OF NOTES (FLOW005): Codechef solution in C++

     SMALLEST NUMBER OF NOTES Problem Code:  FLOW005 Consider a currency system in which there are notes of six denominations, namely, Rs. 1, Rs. 2, Rs. 5, Rs. 10, Rs. 50, Rs. 100. If the sum of Rs.  N  is input, write a program to computer smallest number of notes that will combine to give Rs.  N . Input Format The first line contains an integer  T , total number of testcases. Then follow  T  lines, each line contains an integer  N . Output Format For each test case, display the smallest number of notes that will combine to give  N , in a new line. Constraints 1  ≤   T   ≤  1000 1  ≤   N   ≤  1000000 Sample Input 1  3 1200 500 242 Sample Output 1  12 5 7 Explanation Test Case  1 1 :  There are  8 8  games remaining. Out of these  8 8  games, if RCB wins  2 2  games, loses  4 4  games and draws the remaining  2 2  games they will have a total of 10 points, this shows that it is possible for RCB to qualify for the playoffs. Note: There can be many other combinations which will lead to

MAXIMUM PRODUCTION (EITA) - Codechef solution in C++ language

   MAXIMUM PRODUCTION Problem Code:  EITA Chefland has  7 7  days in a week. Chef is very conscious about his work done during the week. There are two ways he can spend his energy during the week. The first way is to do  � x  units of work every day and the second way is to do  � y  ( > � > x ) units of work for the first  � d  ( < 7 < 7 ) days and to do  � z  ( < � < x ) units of work thereafter since he will get tired of working more in the initial few days. Find the maximum amount of work he can do during the week if he is free to choose either of the two strategies. Input The first line contains an integer  � T , the number of test cases. Then the test cases follow. Each test case contains a single line of input, four integers  � d ,  � x ,  � y ,  � z . Output For each testcase, output in a single line the answer to the problem. Constraints 1 ≤ T ≤ 5 ⋅ 1 0 3 1 ≤ � < 7 1 ≤ d < 7 1 ≤ � < � < � ≤ 18 1 ≤ z < x < y ≤ 18 Example Input: 3 1 2 3 1 6 2