ZJANS

d392. 读取练习——强大的加法!

Easy Last Update: 2026/01/22
輸入處理

解法一、stringstream

✅ 完整代碼

評分結果(參考) : AC (3ms, 344KB)

#include<bits/stdc++.h>
#define int long long
using namespace std;

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    
    string line;
    while(getline(cin, line)){
        stringstream ss(line);
        int num, sum = 0;
        while(ss >> num) sum += num;
        
        cout << sum << "\n";
    }
    
    return 0;
}