#include <iostream>
#include <algorithm>
using namespace std;
int main(){
int stayed, reached, mx, mn, ans1, ans2, ans;
while(cin >> stayed >> reached){
if(stayed == -1 && reached == -1)break;
mx = max(stayed, reached);
mn = min(stayed, reached);
ans1 = mx - mn;
ans2 = (mn+100) - mx;
ans = min(ans1, ans2);
cout << ans << endl;
}
return 0;
}
#include <algorithm>
using namespace std;
int main(){
int stayed, reached, mx, mn, ans1, ans2, ans;
while(cin >> stayed >> reached){
if(stayed == -1 && reached == -1)break;
mx = max(stayed, reached);
mn = min(stayed, reached);
ans1 = mx - mn;
ans2 = (mn+100) - mx;
ans = min(ans1, ans2);
cout << ans << endl;
}
return 0;
}
No comments:
Post a Comment