#include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; bool cmp(const string &s1, const string& s2) {     return s1<s2; } int main() {     vector<string> vs;     string str;     string str1;     vector<string> vso;     int n = 0;     while (cin >> n)     {         if (cin.get() == ' ')             break;     }     while (cin >> str)     {         vs.push_back(str);         if (cin.get() == '\n')             break;     }     for (int i = 0; i<vs.size(); i++)     {         int len = vs[i].length();         if (len % 8 != 0)         {             vs[i].resize(len + 8 - len % 8, '0');             for(int j = 0; j<vs[i].length() / 8; j++)             {                 str1= vs[i].substr(j * 8, 8);                 vso.push_back(str1);             }         }         else if (len == 0)         {             i++;          }         else         {             for (int k = 0; k<vs[i].length() / 8; k++)             {                 str1 = vs[i].substr(k * 8, 8);                 vso.push_back(str1);             }         }     }     sort(vso.begin(), vso.end(), cmp);     for (int m = 0; m<vso.size(); m++)     {         cout << vso[m]<< " ";     }     return 0; } c++渣渣:笔试一直通不过,考完本地测试,不知正确与否
点赞 评论

相关推荐

10-05 23:02
东北大学 Java
我说句实话啊:那时候看三个月培训班视频,随便做个项目背点八股,都能说3 40w是侮辱价
点赞 评论 收藏
分享
牛客网
牛客企业服务