Aniruddha's Queue
Practice
3.9 (27 votes)
Approved
Basic programming
Easy
Open
Problem
81% Success 23171 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

Aniruddha is given a milestone M to reach in terms of distance. He is living in a different Galaxy where there are N days in a year.At the ith day he can walk atmost X distance.Assuming he walks optimally you need to output the minimum day number on which he will reach the milestone.

Input

The first input line contains the T number of testcases. Each testcase consist of three lines First line consist of single integer N — the number of days in a year.

Next line contains N non-negative space-separated numbers— i.e. distance which Aniruddha will walk on ith day. It is guaranteed that at least one of those numbers is greater than zero.

And the third line consist of the value of milestone which Aniruddha has to reach.

Output

For each testcase you need to output the answer to the following query.

Constraints

1<=T<= 10

1<=N<=10^5

0<=X<=10^8

0<=M<=10^16

Please login to use the editor

You need to be logged in to access the code editor

Loading...

Please wait while we load the editor

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
12 votes
Tags:
ApprovedBasic ProgrammingBrute-force searchEasyOpen
Points:20
27 votes
Tags:
ImplementationBasic ProgrammingBasic Math
Points:20
58 votes
Tags:
ArraysEasyMath