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 | mahbubcseju | Cpp14 | 0.00s |

02 | Double_O | Cpp | 0.00s |

03 | Zeronfinity | Cpp | 0.00s |

04 | amin21 | Cpp | 0.00s |

05 | akazad_cse13_ruet | Cpp | 0.00s |

06 | badhansen123 | Cpp | 0.00s |

07 | CLown1331 | Cpp | 0.00s |

08 | shahidul_brur | Cpp | 0.00s |

09 | showmic | Cpp14 | 0.00s |

10 | Tanmoy | Cpp | 0.00s |

11 | adamantium | Cpp | 0.00s |

12 | sajjad_h | Cpp | 0.00s |

13 | Dragon_Curve | Cpp | 0.00s |

14 | dot0 | Cpp14 | 0.00s |

15 | Hasinur_ | Cpp | 0.00s |

16 | prottoy919 | Cpp | 0.00s |

17 | Tahmid | Cpp14 | 0.00s |

18 | feodorv | C | 0.00s |

19 | snow_man | Cpp14 | 0.00s |

20 | rakibislam1996 | Cpp14 | 0.00s |

21 | mir003 | Cpp | 0.00s |

22 | Bappy | Cpp14 | 0.00s |

23 | nasib_mbstu | Cpp | 0.00s |

24 | tanu_1603070 | Cpp | 0.00s |

25 | ikaadil | Cpp | 0.00s |

26 | Mushfiqur_Rahman | C | 0.00s |

27 | tahsin_protik | C | 0.00s |

28 | rfnamd_ju | C | 0.00s |

29 | madcoder_ju | Cpp | 0.00s |

30 | t_33 | Cpp | 0.00s |

31 | level_zero | Cpp14 | 0.00s |

32 | sakib_cse17 | C | 0.00s |

33 | Rakib31 | Cpp | 0.00s |

34 | hassanmdsifat | Cpp | 0.00s |

35 | _cicipi_ | Cpp14 | 0.00s |

36 | not_good_enough | Cpp | 0.00s |

37 | i_akash | Cpp | 0.01s |

38 | shutki | Cpp | 0.01s |

39 | limlimu | Cpp | 0.01s |

40 | shafin666 | Cpp | 0.01s |

41 | spectro30 | Cpp | 0.01s |

42 | Red_Sparkel | Cpp | 0.01s |

43 | Towfiq379 | Cpp | 0.01s |

44 | ehsan_sshuvo96 | Cpp | 0.01s |

45 | dmehedi | Cpp | 0.01s |

46 | Nuwaisir | Cpp | 0.01s |

47 | pencil | Cpp | 0.01s |

48 | prateepm | Cpp14 | 0.01s |

49 | de_aztech | Cpp | 0.01s |

50 | we7d | 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. :(