jain12

foodie

Mar 8th, 2020
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main() {
  6.     int time;
  7.     cin>>time;
  8.     int pos;
  9.     while(time>0){
  10.       pos=0;
  11.       int total_stall;
  12.       cin>>total_stall;
  13.       int arr[total_stall];
  14.       for(int i=0;i<total_stall;i++)
  15.         cin>>arr[i];
  16.       while(arr[pos]!=0){
  17.         pos= (pos+1)%total_stall;
  18.         for(int i=0;i<total_stall;i++)
  19.           if(arr[i]!=0)
  20.             arr[i]--;
  21.         }
  22.       cout<< endl<<pos+1;
  23.       time--;
  24.       }
  25. }
Add Comment
Please, Sign In to add comment