# 題目: UVa 1260 - Sales
# 題目說明
給一連串每日的銷售額,求銷售額大於等於以往銷售額的總數
INPUT:
第一行輸入一個整數t,代表測資數
每筆測資第一行輸入一個整數n
接下來有n個整數,代表每日的銷售額
OUTPUT:
輸出銷售額大於等於以往銷售額的總數
# 解題方法
使用vector儲存資料
直接使用2個迴圈進行判斷即可
# 參考程式碼
#include <iostream>
#include <vector>
using namespace std;
static auto fast_io = []
{
ios::sync_with_stdio(false);
cout.tie(nullptr);
cin.tie(nullptr);
return 0;
}();
int main()
{
int T, N, a;
cin >> T;
while (T--)
{
vector<int> V;
int cnt = 0;
cin >> N;
while (N--) cin >> a, V.push_back(a);
for (int i = 1; i < V.size(); ++i)
for (int j = 0; j < i; ++j)
if (V[i] >= V[j]) ++cnt;
cout << cnt << "\n";
}
}