Easy Beginners Problems > Implementation

**Mr BBK** don’t fall into sleep before 2 PM. So, His mother suggested him to count numbers in reverse order. It is guaranteed that he fall into sleep if he counts at least 100 numbers sequentially in reverse order. Every number have **Sleepiness** value. When he pronounce/call the number, he gains Sleepiness value of that number. If summation of Sleepiness value >= **K** , he fall into sleep. Counting a number takes one second. His target is to fall into sleep as early as possible. He wants help to find the **minimum time** needed to fall into sleep for Mr BBK. He can choose any number <= 100 and starts counting numbers in reverse order sequentially. He stops counting automatically when he fall into sleep. Input: ------ This is a smaple input detail. Please put your input detail here. For example, Input starts with an integer **T (1<=100)**, denoting the number of test cases. Each case contains a positive integer **K**. The next line will contain **100** integers separated by spaces, denoting the Sleepiness values of the numbers from 1 to 100. **Constraints** 1<=Sleepiness value <= 100 1<= K <= ( Sum of Sleepiness values from 1 to 100 ) Output: ------- For each test case, print the minimum time needed to fall into sleep for Mr BBK. Sample Input ------------ 1 2546 8 50 74 59 31 73 45 79 24 10 41 66 93 43 88 4 28 30 41 13 4 70 10 58 61 34 100 79 17 36 98 27 13 68 11 34 80 50 80 22 68 73 94 37 86 46 29 92 95 58 2 54 9 45 69 91 25 97 31 4 23 67 50 25 2 54 78 9 29 34 99 82 36 14 66 15 64 37 26 70 16 95 30 2 18 96 6 5 52 99 89 24 6 83 53 67 17 38 39 45 Sample Output ------------- 50

Bir Bahadur Khatri

Language |
Time Limit (seconds) |

C | 1.00 |

C++ | 1.00 |

C++14 | 1.00 |

C# | 2.00 |

Go | 2.00 |

Java | 2.00 |

JavaScript | 2.00 |

Objective-C | 2.00 |

Perl | 2.00 |

PHP | 2.00 |

Python | 2.00 |

Python3 | 2.00 |

Ruby | 2.00 |

VB.Net | 2.00 |

Solve/Submission

# | User | Language | Timing |
---|---|---|---|

01 | CLown1331 | Cpp | 0.00s |

02 | Hasinur_ | Cpp | 0.00s |

03 | madcoder_ju | Cpp | 0.00s |

04 | nasib_mbstu | Cpp | 0.00s |

05 | showmic | Cpp14 | 0.00s |

06 | adamantium | Cpp | 0.00s |

07 | Tahmid | Cpp14 | 0.00s |

08 | tanu_1603070 | Cpp | 0.00s |

09 | Zeronfinity | Cpp | 0.00s |

10 | snow_man | Cpp14 | 0.00s |

11 | shahidul_brur | Cpp | 0.00s |

12 | badhansen123 | Cpp | 0.00s |

13 | amin21 | Cpp | 0.00s |

14 | mir003 | Cpp | 0.00s |

15 | Dragon_Curve | Cpp | 0.00s |

16 | level_zero | Cpp14 | 0.00s |

17 | _cicipi_ | Cpp14 | 0.00s |

18 | t_33 | Cpp | 0.00s |

19 | sajjad_h | Cpp | 0.00s |

20 | ikaadil | Cpp | 0.00s |

21 | dot0 | Cpp14 | 0.00s |

22 | hassanmdsifat | Cpp | 0.00s |

23 | tahsin_protik | C | 0.00s |

24 | Double_O | Cpp | 0.00s |

25 | Rakib31 | Cpp | 0.00s |

26 | Mushfiqur_Rahman | C | 0.00s |

27 | sakib_cse17 | C | 0.00s |

28 | Tanmoy | Cpp | 0.00s |

29 | rakibislam1996 | Cpp14 | 0.00s |

30 | akazad_cse13_ruet | Cpp | 0.00s |

31 | mahbubcseju | Cpp14 | 0.00s |

32 | rfnamd_ju | C | 0.00s |

33 | Bappy | Cpp14 | 0.00s |

34 | prottoy919 | Cpp | 0.00s |

35 | feodorv | C | 0.00s |

36 | sharmin6630 | Cpp | 0.00s |

37 | SAIF_IIT8_JU | Cpp | 0.01s |

38 | leenaiitju | Cpp | 0.01s |

39 | ansar_ict | Cpp14 | 0.01s |

40 | asad_IT | Cpp | 0.01s |

41 | tariqiitju | Cpp | 0.01s |

42 | Bipro_Bhowmik | Cpp14 | 0.01s |

43 | shafin666 | Cpp | 0.01s |

44 | pencil | Cpp | 0.01s |

45 | rummanrakib11 | Cpp | 0.01s |

46 | Ishraq_Nibir | Cpp | 0.01s |

47 | hamza133913 | Cpp | 0.01s |

48 | bu_hridoy | Cpp | 0.01s |

49 | wizard | Cpp | 0.01s |

50 | dmehedi | Cpp | 0.01s |

Copyright © 2015-2016 Dev Skill.

Feedback
#### Your feedback is our precious!

## Thank you for providing feedback! Our developers will be happy :)

## Sorry there was a problem when submitting the feedback. Please try again. :(