Advertisement
rotti321

Untitled

Oct 23rd, 2017
174
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.48 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main(){
  6. ifstream f("sumpow2.in");
  7. ofstream g("sumpow2.out");
  8. int nr=0;
  9. string a, b;
  10. f>>a>>b;
  11. for(int i=0; i<a.length(); ++i){
  12. int p=((int)(a[i]-97));
  13. nr+=1<<p;
  14. }
  15. for(int i=0; i<b.length(); ++i){
  16. int p=((int)(b[i]-97));
  17. nr+=1<<p;
  18. }
  19. int n=0;
  20. while(nr){
  21. if(nr%2) g<<(char)(97+nr);
  22. nr/=2;
  23. n++;
  24. }
  25.  
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement