Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits\stdc++.h>
- using namespace std;
- int main()
- {
- int n, i;
- cin >> n;
- int s[n], d[n];
- for(i = 0; i < n; i++) cin >> s[i] >> d[i];
- for(i = 1; i < n; i++)
- {
- while(s[i-1] >= s[i]) s[i] += d[i];
- }
- //for(i = 0; i < n; i++) cout << s[i] << endl;
- cout << s[n-1] << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement