Untitled

 avatar
unknown
c_cpp
a year ago
321 B
5
Indexable
long count = 0;
   int minIndex = -1, maxIndex = -1;
   
   
   
   for(int i=0;i<prices.size();++i)
   {
       if(maxIndex == -1 && prices[i] == maxPrice)
       maxIndex = i;
       if(prices[i] == minPrice)
       minIndex = i;
       
       
   }
   cout<<(maxIndex+1)*(prices.size()-minIndex)<<endl;

    return 0;
Editor is loading...
Leave a Comment