提交时间:2024-08-20 12:42:10

运行 ID: 168639

#include <bits/stdc++.h> using namespace std; int n, a, b, num[105]; int main() { cin >> n; for (int i = 0; i < n; i++) { cin >> a >> b; num[i] += a + b; } for (int i = n - 1; i >= 0; i--){ if (num[i] >= 10 && i) { int tmp = num[i] % 10; num[i] = tmp; ++num[i - 1]; } } for (int i = 0; i < n; i++) cout << num[i]; cout << endl; return 0; }