UVA1260:

Sales

#include <iostream>

using namespace std; 

int main(){
	int n, m, in; 

	cin >> n; 
	for(int i = 0; i < n; i++){
		cin >> m;
		int arr[m];
		for(int j = 0; j < m; j++){
			cin >> in;
			arr[j] = in;
		}

		int store = 0; 

		for(int k = m-1; k >= 0; k--){
			int b = 0; 
			for(int u = k -1; u >= 0; u--){
				if(arr[k] >= arr[u]){
					b++;
				}
			}

			store += b;

		}

		cout << store << endl;

	}

	return 0;

}
[Back to Listing Page]

Home

Posts

Projects

Github

Contact

janzzen

Developed by Janzzen Ang powered by Vercel