#1720140

Solution for 0088: The Code A Doctor Loved by nakamasa

Source Code Status Test Cases
    Policy: public     Reviewed: 24    
00.00 sec    1188 KB    27 lines     1056 bytes    2016-04-03 14:51
#include<bits/stdc++.h>
using namespace std;
int main()
{
    string str;
    string first=" ',-.?ABCDEFGHIJKLMNOPQRSTUVWXYZ",secound="ABCDEFGHIJKLMNOPQRSTUVWXYZ .,-'?";
    string conversion[32]={"101","000000","000011","10010001","010001","000001","100101","10011010","0101","0001",
    "110","01001","10011011","010000","0111","10011000","0110","00100","10011001","10011110","00101","111","10011111",
    "1000","00110","00111","10011100","10011101","000010","10010010","10010011","10010000"};
    while(getline(cin,str)){
        string Midstream;
        for(int i=0;str[i]!='\0';i++){
            for(int j=0;j<33;j++)if(str[i]==first[j])Midstream+=conversion[j];
        }
        for(int i=0;i<Midstream.size()%5;i++)Midstream+='0';
        for(int i=0,point=0;Midstream[i]!='\0';i++){
            if(i%5==4){
                int num=0;
                for(int j=point,kawa[5]={1,2,4,8,16};j<=i;j++)num+=(Midstream[j]-'0')*kawa[i-j];
                cout<<secound[num];
                point=i+1;
            }
        }
        cout<<endl;
    }
}

Compile Error Logs:
You are not authorized to see the message.

Status
Judge: 1/1 C++ CPU: 00.00 sec Memory: 1188 KB Length: 1056 B 2016-04-03 14:51 2016-04-03 14:51
Results for testcases
Case # Verdict CPU Time Memory In Out Case Name
Case #1: : Accepted 00.00 sec 1188 KB
< prev | / | next >  
 
Judge Input #  ( | ) Judge Output #  ( | )


Comments
 
 Under Construction.
 
Categories
 
 
Free Tags