Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- using namespace std;
- int main()
- {
- ios::sync_with_stdio(0);
- int n;
- cin >> n;
- long long mn=1e9, sum = 0;
- for (int i = 0; i < n; i++) {
- long long dop1, dop2;
- cin >> dop1 >> dop2;
- sum += max(dop1, dop2);
- if ((dop1 - dop2) % 10 != 0) {
- mn = min(mn, abs(dop1 - dop2));
- }
- }
- if (sum % 10 == 5) {
- sum -= mn;
- }
- cout <<sum<<endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement