fork download
  1. #include <iostream>
  2. #include <cstdio>
  3. using namespace std;
  4.  
  5. int main() {
  6. long long int t, n, a;
  7. scanf("%lld", &t);
  8. while(t--) {
  9. scanf("%lld", &n);
  10. for(int i=0; i<n; i++) scanf("%lld", &a);
  11. printf("%lld\n", n*(n-1)/2);
  12. }
  13. return 0;
  14. }
Success #stdin #stdout 0s 3344KB
stdin
2
2
2 1
3
3 1 2
stdout
1
3