Promi_38

cf 879A

Oct 22nd, 2021
588
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <bits\stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.     int n, i;
  8.     cin >> n;
  9.    
  10.     int s[n], d[n];
  11.     for(i = 0; i < n; i++) cin >> s[i] >> d[i];
  12.     for(i = 1; i < n; i++)
  13.     {
  14.         while(s[i-1] >= s[i]) s[i] += d[i];
  15.     }
  16.     //for(i = 0; i < n; i++) cout << s[i] << endl;
  17.     cout << s[n-1] << endl;
  18. }
  19.  
RAW Paste Data