fork(3) download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define lli long long int
  4. #define inf 1000000000
  5. #define pb push_back
  6. #define mp make_pair
  7. #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
  8. #define endl "\n"
  9. #define yoi cout<<"yo"<<endl;
  10. #define debug(x) cerr << #x << " is " << x << endl;
  11. #define all(x) x.begin(),x.end()
  12. const int mod=1e9+7;
  13. int main(){
  14. IOS;
  15. int n;
  16. cin>>n;
  17. int a[n],i,j;
  18. int bitscore[n][2];
  19. for(i=0;i<n;i++){
  20. cin>>a[i];
  21. }
  22. for(i=0;i<n;i++){
  23. int x=a[i];
  24. vector<int> v;
  25. while(x){
  26. v.pb(x%10);
  27. x/=10;
  28. }
  29. sort(all(v));
  30. int score=(v[2]*11)+(v[0]*7);
  31. score=score%100;
  32. bitscore[i][0]=score;
  33. bitscore[i][1]=score/10;
  34. }
  35. int auxi[10];
  36. int pairs=0;
  37. memset(auxi,0,sizeof(auxi));
  38. for(i=0;i<n;i++){
  39. for(j=i+1;j<n;j++){
  40. if((i%2)!=(j%2))
  41. continue;
  42. if(bitscore[i][1]==bitscore[j][1]&&(auxi[bitscore[i][1]]<2)){
  43. pairs++;
  44. auxi[bitscore[i][1]]++;
  45. }
  46. }
  47. }
  48. cout<<pairs;
  49. }
  50.  
Runtime error #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
Standard output is empty