-
-
Save ArthurLoboLobo/0788012b7de81c14b5ad868cfaa1a4a4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<bits/stdc++.h> | |
using namespace std; | |
const int maxn = 1e5+10; | |
int n, a[maxn], b[maxn]; | |
int main() { | |
cin >> n; | |
for(int i = 1; i <= n; i++) { | |
cin >> a[i]; | |
} | |
for(int i = 1; i <= n; i++) { | |
cin >> b[i]; | |
} | |
int pagar = 0; | |
int receber = 0; | |
for(int i = 1; i <= n; i++) { | |
if(a[i] >= b[i]) { | |
receber+= a[i]-b[i]; | |
} | |
else { | |
pagar+= b[i]-a[i]; | |
} | |
} | |
cout << receber << " " << pagar; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment