I love Kunlun
Time Limit : 3000/1000ms (Java/Other) Memory Limit : 65535/32768K (Java/Other)
Total Submission(s) : 389 Accepted Submission(s) : 114
Font: Times New Roman | Verdana | Georgia
Font Size: ← →
Problem Description
One day, ZHJ came across a warrior novel named Kunlun in library. Soon, ZHJ fall into it.
He tells everybody how deeply he loves Kunlun no matter whom he meets.
He found it attractive so he decided to read the novel in the next N days. However, ZHJ had
his own schedule. So every day he had only few minutes to spend on the book. Besides, he was
accustomed to reading a novel continuously, that is, once he started to read the novel, he would
not stop until he had read the entire novel.
ZHJ wondered when he should begin to read the novel so that he could spend the least days
on the novel.
He tells everybody how deeply he loves Kunlun no matter whom he meets.
He found it attractive so he decided to read the novel in the next N days. However, ZHJ had
his own schedule. So every day he had only few minutes to spend on the book. Besides, he was
accustomed to reading a novel continuously, that is, once he started to read the novel, he would
not stop until he had read the entire novel.
ZHJ wondered when he should begin to read the novel so that he could spend the least days
on the novel.
Input
The input contains several cases.
The first line of each case contains two space-seperated integers N(2 <= N <= 10^5) and S(1 <= S <= 10^8) where N means ZHJ decides to finish the novel in the next N days, S means the novel would cost ZHJ S minutes.Then N lines follows.The ith line contains an integer ai(1 <= ai <= 100) which means ZHJ has ai minutes' free time in the ith day.It is guaranteed that the sum of the free time of the N days is enough for ZHJ to finish the novel.
The first line of each case contains two space-seperated integers N(2 <= N <= 10^5) and S(1 <= S <= 10^8) where N means ZHJ decides to finish the novel in the next N days, S means the novel would cost ZHJ S minutes.Then N lines follows.The ith line contains an integer ai(1 <= ai <= 100) which means ZHJ has ai minutes' free time in the ith day.It is guaranteed that the sum of the free time of the N days is enough for ZHJ to finish the novel.
Output
For each test case, you should output a single line with a integer indicating the day ZHJ should start to read the novel.If there are several answers, output the smallest one.
Sample Input
2 100 99 100 20 100 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
Sample Output
2 15
Author
Source
2012年华南师范大学校赛初赛