当前位置: 代码迷 >> 综合 >> ACM Plan UVa - 1260 Sales
  详细解决方案

ACM Plan UVa - 1260 Sales

热度:115   发布时间:2023-10-15 12:41:07.0

Talk is cheap. Show me the code. —— Linus Torvalds

#include <iostream>
#include <cstdio>
using namespace std;
const int MAX = 1010;
int main()
{
    //freopen("i.txt", "r", stdin);int t, n, a[MAX], ans = 0;scanf("%d", &t);while(t--){
    ans = 0;scanf("%d", &n);for(int i = 0; i < n; i++) scanf("%d", &a[i]);for(int i = 1; i < n; i++)for(int j = 0; j < i; j++)if(a[j] <= a[i]) ans++;printf("%d\n", ans);}return 0;
}
  相关解决方案