先位移,再轉二進制

 

#include <iostream>
#include <cctype>
#include <bitset>

using namespace std;

int main()
{
    int map_length, map_width;
    while(cin >> map_length >> map_width){
        for(int i = 0; i<map_length; i+=1){
            string input;
            cin >> input;
            for(char &j : input){
                if(isupper(j)) j -= 'A';
                else if (islower(j)) j -= 'a' - 26;
                else if (isdigit(j)) j -= '0' - 52;
                else if (j == '+') j = 62;
                else j = 63;

                bitset<6> base64(j);
                cout << base64;
            }

            cout << endl;
        }
    }

    return 0;
}

arrow
arrow
    全站熱搜

    大神(偽) 發表在 痞客邦 留言(0) 人氣()