fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. int main() {
  5. int rad[]={1,1,1,2,2};
  6. int vis=0;
  7. int index_1=0 , index_2=0,i,j;
  8. sort(rad,rad+5);
  9. for(int j=0;j<5;j++)
  10. {
  11. for(int i=j+1;i<5;i++)
  12. {
  13. if(rad[i]>rad[j])
  14. {
  15. if(i==index_2)
  16. {
  17. continue;
  18. }
  19. index_1=j;
  20. index_2=i;
  21. vis++;
  22. break;
  23. }
  24. }
  25. }
  26. int ans= 5-vis;
  27. cout<<ans<<endl;
  28. }
Success #stdin #stdout 0s 4264KB
stdin
Standard input is empty
stdout
2