Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- ifstream fin("sumpow2.in");
- ofstream fout("sumpow2.out");
- int n, v[]={1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768}, sm;
- char ch, s[]="abcdefghijklmnop";
- int main()
- {
- while(fin>>ch)
- sm+=v[s[ch-'a']-'a'];
- while(sm != 0)
- {
- if(sm%2==1)
- fout<<s[n];
- sm /= 2;
- n++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement