解法

字符串分隔

http://www.nowcoder.com/questionTerminal/d9162298cb5a437aad722fccccaae8a7

include

include

include

using namespace std;
int main(){
string str;
vector<string>s;
while(getline(cin,str)){
if(str.length()==0){
break;
}
if(str.length()<8){
for(int i=str.length();i<8;i++){
str=str+"0";
}
s.push_back(str);
continue;</string>

    }
    if(str.length()==8){
        s.push_back(str);

    }
    while(str.length()>8){
        s.push_back(str.substr(0,8));

        str=str.substr(8,str.length());
        if(str.length()<8){
            for(int i=str.length();i<8;i++){
                           str=str+"0";
                       }
            s.push_back(str);

        }
        else if(str.length()==8){
            s.push_back(str);
        }

    }
}

for(vector<string>::iterator p=s.begin();p!=s.end();p++){
    cout<<*p<<endl;
}

}

全部评论

相关推荐

陆续:不可思议 竟然没那就话 那就我来吧 :你是我在牛客见到的最美的女孩
点赞 评论 收藏
分享
鬼迹人途:你去投一投尚游游戏,服务器一面,第一个图算法,做完了给你一个策略题,你给出方案他就提出低概率问题,答不上当场给你挂
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务