Advertisement
9I_HE_TbI_A_9I

Untitled

Oct 20th, 2021
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include <iostream>
  2. #include <vector>
  3. #include <algorithm>
  4.  
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9. ios::sync_with_stdio(0);
  10. int n;
  11. cin >> n;
  12. long long mn=1e9, sum = 0;
  13. for (int i = 0; i < n; i++) {
  14. long long dop1, dop2;
  15. cin >> dop1 >> dop2;
  16. sum += max(dop1, dop2);
  17. if ((dop1 - dop2) % 10 != 0) {
  18. mn = min(mn, abs(dop1 - dop2));
  19. }
  20. }
  21. if (sum % 10 == 5) {
  22. sum -= mn;
  23. }
  24. cout <<sum<<endl;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement