fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. int t;
  6. cin>>t;
  7. while(t--)
  8. {
  9. int n,i,f,count=0;
  10. for(i=0;i<n;i++)
  11. {
  12. cin>>f;
  13. }
  14. for(i=0;i<n;i++)
  15. {
  16. for(int j=i+1;j<n;j++)
  17. {
  18. if(i!=j)
  19. {
  20. count=count+1;
  21. }
  22. if(i==j)
  23. {
  24. break;
  25. }
  26. }
  27. }
  28. cout<<count<<"\n";
  29.  
  30. }
  31. return 0;
  32. }
Success #stdin #stdout 0.01s 5460KB
stdin
4
1
5
2
1 1
3
1 2 3
4
2 1 2 2
stdout
0
0
0
0