My issue
Two unknown test cases are failing. Moreover, accepted solutions have used to sum of terms in an ap which I don’t understand why
My code
#include <iostream>
#include<algorithm>
using namespace std;
int main() {
int t;
cin>>t;
while(t--){
//distinct integers hai
int n;
cin>>n;
int a[n];
for(int i=0;i<n;i++){
cin>>a[i];
}
sort(a, a+n);
int count =0;
for(int i=0;i<n-1;i++){
for(int k=i+1;k<n;k++){
count++;
}
}
cout<<count<<endl;
}
return 0;
}
Problem Link: ALEXNUMB Problem - CodeChef