-
-
Save Hacv16/82ce4c039f8ba33669ef8d51ca7debfb 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; | |
int main() | |
{ | |
ios_base::sync_with_stdio(false); | |
cin.tie(NULL); | |
int n; cin >> n; | |
int resp = 0; | |
for(int i = 1; i <= n; i++) | |
{ | |
int c, s; cin >> c >> s; | |
int horario = (c > s ? c - s : s - c); | |
int antihorario = (c > s ? 10 + s - c : 10 + c - s); | |
resp += min(horario, antihorario); | |
} | |
cout << resp << '\n'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment