Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- using namespace std;
- int a, b, c[1000001];
- int main()
- {
- int
- long long n, x = 0;
- cin >> n;
- for (int i = 1; i <= n; i++)
- {
- cin >> a >> b;
- c[i] = a + b;
- }
- for (int i = n; i >= 1; i--)
- {
- if (c[i] + x < 10)
- {
- c[i] = c[i] + x;
- x = 0;
- }
- else
- {
- c[i] = c[i]+x - 10;
- x = 1;
- }
- }
- if (x == 1) cout << 1;
- for (int i = 1; i <= n; i++)
- cout << c[i];
- _getch();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment