Codeforces 1213B. Bad Prices Solution
Solve in C:
- ///**********ALLAH IS ALMIGHTY************///
- ///AH Tonmoy
- ///Department of CSE
- ///Islamic University,Bangladesh
- #include<iostream>
- using namespace std;
- int main(){
- long long int i,ar[150009]={0},t,v,n;
- cin>>t;
- while(t--)
- {
- int r=0;
- cin>>n;
- for(i=0;i<n;i++)
- {
- cin>>ar[i];
- }
- v=ar[n-1];
- for(i=n-1;i>=0;i--)
- {
- if(v<ar[i])
- r++;
- else
- v=ar[i];
- }
- cout<<r<<endl;
- }
- }
No comments