1 条题解

  • 1
    @ 2025-4-16 12:55:20
    #include<bits/stdc++.h>
    using namespace std;
    int main(){
        string s;
        cin >> s;
        int total = 0;
        string current_num = "";
    
        for (char c : s) {
            if (isdigit(c)) {
                current_num += c;
            } else {
                if (!current_num.empty()) {
                    total += stoi(current_num);
                    current_num = "";
                }
            }
        }
        if (!current_num.empty()) {
            total += stoi(current_num);
        }
    
        cout << total << endl;
        return 0;
    }
    • 1

    信息

    ID
    707
    时间
    1000ms
    内存
    256MiB
    难度
    10
    标签
    递交数
    5
    已通过
    1
    上传者