fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. int a[1000000];
  4. int main(){
  5. int n,k;
  6. cin>>n>>k;
  7. for(int i=1;i<=n;i++){
  8. cin>>a[i];
  9. }
  10. long long jumlah=0;
  11. for(int i=1;i<=n;i++){
  12. for(int j=i+1;j<=n;j++){
  13. if(a[i]!=a[j]){
  14. jumlah++;
  15. }
  16. }
  17. }
  18. cout<<jumlah;
  19. }
Success #stdin #stdout 0s 5648KB
stdin
Standard input is empty
stdout
Standard output is empty