Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main() {
- int time;
- cin>>time;
- int pos;
- while(time>0){
- pos=0;
- int total_stall;
- cin>>total_stall;
- int arr[total_stall];
- for(int i=0;i<total_stall;i++)
- cin>>arr[i];
- while(arr[pos]!=0){
- pos= (pos+1)%total_stall;
- for(int i=0;i<total_stall;i++)
- if(arr[i]!=0)
- arr[i]--;
- }
- cout<< endl<<pos+1;
- time--;
- }
- }
Add Comment
Please, Sign In to add comment