Advertisement
a53

perechi3

a53
Nov 20th, 2020
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #include<fstream>
  2. #include<cstring>
  3. using namespace std;
  4. char s[35];
  5. int i, n, x;
  6. long long sol;
  7. int ff[ (1 << 16) + 5];
  8. ifstream fin("perechi.in");
  9. ofstream fout("perechi.out");
  10. int main(){
  11. while(fin>> s){
  12. n = strlen(s);
  13. x = 0;
  14. for(i = 0; i < n; i++){
  15. if(s[i] >= '0' && s[i] <= '9'){
  16. x |= ( 1 << (s[i] - '0') );
  17. }
  18. else{
  19. x |= ( 1 << (10 + s[i] - 'A') );
  20. }
  21. }
  22. sol += ff[ (1 << 16) - 1 - x ];
  23. ff[x]++;
  24. }
  25. fout<< sol;
  26. }
  27.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement