Jeremiah_

ABC_125 - B - Resale

May 30th, 2019
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.95 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. #define forn(l, r) for(int i = l; i < (r); ++i)
  4. #define forj(l, r) for(int j = l; j < (r); ++j)
  5. #define TAM 1000100
  6. #define SYNC ios::sync_with_stdio(0);
  7. #define $ << ' ' <<
  8. #define F first
  9. #define S second
  10. #define endl '\n'
  11.  
  12.  
  13. using namespace std;
  14.  
  15. using ll = long long int;
  16. using ii = pair<int, int>;
  17. using vii = vector<ii>;
  18. using vi = vector<int>;
  19. using graph = vector<vi>;
  20. const int INF = 0x3f3f3f3f;
  21. const int MAXN = 112345;
  22. const ll mod = 1000000007;
  23.  
  24.  
  25. int main() {
  26.     //SYNC
  27.     int n, ans = 0;
  28.     vector<int> gems, cost;
  29.     cin >> n;
  30.     gems.assign(n, 0);
  31.     cost.assign(n, 0);
  32.     for (auto &k : gems) {
  33.         cin >> k;
  34.     }
  35.     for (auto &j : cost) {
  36.         cin >> j;
  37.     }
  38.     for (int i = 0; i < n; ++i) {
  39.         if (gems[i] > cost[i]) {
  40.             ans += gems[i] - cost[i];
  41.         }
  42.     }
  43.     //cout << gems[0] << ' ' << cost[0] << endl;
  44.     cout << ans << endl;
  45.  
  46.     return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment