返回题解分享
讨论 / 题解分享/ 帖子详情

字符串编号(编程题) - 题解

#include <bits/stdc++.h>

using namespace std;

int main() {

    string str;

    cin >> str;

    int len = str.size();
    int i = 0;
    while (i <= len) {
        int s = stoi(str.substr(i, 2));
        if (s <= 26) {
            cout << (char)('A' + s - 1);
            i += 2;
        } else {
            cout << (char)('A' + str[i] - '0' - 1);
            i++;
        }
    }
}
0 回复 0 转发 0 喜欢 2 阅读
回复 (0)
默认 最新
暂无回复,快来抢沙发!