8 条题解

  • 0
    @ 2025-1-19 19:07:06

    #include <iostream> #include<sstream> using namespace std; int main() { int p = 0, q = 1, num = 1; string str; stringstream ss; cin >> str; while (q < str.size()) { if (str[p] == str[q]) { num++; if (q == str.size() - 1) { ss << str[p] << num; } q++; } else { if(q!=str.size()-1){ ss << str[p] << num; p = q;q = q + 1;num = 1; } else { ss << str[p] << num; num = 1; ss << str[q] << num; q++; } } } cout << ss.str(); return 0; }

    信息

    ID
    65
    时间
    1000ms
    内存
    256MiB
    难度
    4
    标签
    递交数
    230
    已通过
    109
    上传者