question, try to provide solution as early as possible
Note: You need to press "Final Submit" for your program Rajesh bought a gift for her daughter. It is small gaming device. It basically contains 2 small screens and 2 buttons just below the screens. 200 is how this device works: The device works on a battery which has N unit of power. When the device is switched on, both screens displays 0. When Button-1 is pressed, then the counter of the screen-1 is incremented by 1. ● •When Button-2 is pressed, 116231 • Every Time Button-1 is pressed, 1 consumed. . ● of power is the counter of the Screen-2 is incremented by the value on screen-1. • Every Time Button-2 is pressed, B unit of power is consumed. . 6743311 160 B=1 Now, Rajesh has asked his daughter to tell him, what is the maximum possible value she can display on screen-2, when N&B are mentioned. 26743ample Let say: 267433 understand it with and +298 2674
Button Screen-1 1 NTTTT 267 1 1 1 2 22 2 12344 261-8 B = 5 4 4 Example 2: Input: 85 -> Input integer, N & B Output: 3-> Output Explanation: In the above scenario 31 Screen-2 0 0 0 0 4 8 12 Power 1 1 26712 10 1 Total power consumed = 1+1+1+1+2+2+2=10 Maximum Value on Screen Hence the answer is 12. 122 2 2 2674331160 231 63116 267433116 91187297
Button Screen-1 12 123333 1 1 2 22 2 PEREZ Screen-2 Example 1: Input: 10 2 -> Input integer, N & B Output: 12 -> Output Explanation: In the 26743 ove scenario 0 0 636OO 0 9 So the maximum value that can be achteved on Screen-2 with 6 unit of power is 9. Hence the answer is 9. 2674331160 Power 1 1 574331160 231 1 1 1 1 31160 2 2674331160 574331160
Button Screen-1 Screen-2 1 1 112 2 1 2 33 Constraints: 26 <=B<N<= 100000 0 0 Total power consumed = 1 +1+1+5=8 Maximum Value on Screen 2:3 Hence the answer is 3. 03 Instructions: A The Output format for testing The output is an integer as per output in Example 1, Example 2 26231 Power 1 1 2674331160 231 1 5 The input format for testing First Input - Accept value of integer N . Second Input - Accept value of integer B (Next line) 2674 2674331160 231 logic. (Check the Additional messages in output will cause the failure of test cases. 2674331160 23 31160 231
Total power consumed +53² Maximum Value on Screen 2: 3 consumed = 1+1+1+ 267Ance the answer is 3. Constraints: • 1 <= B <N<= 100000 2674331160-3231 The input format for testing • First Input - Accept value of integer N Second Input - Accept value of integer B (Next line) 60 The output is an integer as per above logic. (Check the 231160 Coutput in Example 1, Example 2). • Additional messages in output will cause the failure of test cases. The Output format for testing 2674331160 Instructions: • System doesn't allow any kind of hard coded input value/ Written Bainst the inputs which are g 267 ogram code by the candidate will be verified 2674pplied from the system. 2674331160
This is the Note: You need to press "Final Submit" for your program Rajesh bought a gift for her daughter. It is small gaming device
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am