提交时间:2024-08-20 20:18:18
运行 ID: 169923
#include <bits/stdc++.h> using namespace std; int main(){ int n,a[108],b[108],c[108],f = 0; cin >> n; for(int i = 1;i <= n;i++){ cin >> a[i] >> b[i]; } for(int i = n;i >= 1;i--){ c[i] = a[i] + b[i]; if(f) c[i]++; f = 0; if(c[i] >= 10 && i != 1){ c[i] %= 10; f = 1; } else if(c[i] >= 10 && i == 1){ continue; } } for(int i = 1;i <= n;i++){ cout << c[i]; } return 0; }