Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- int main()
- {
- int t;
- scanf("%d", &t);
- while(t--)
- {
- long long a, b;
- cin >> a >> b;
- long long cnt = 0, x = abs(a-b);
- while(x >= 5)
- {
- cnt += x / 5;
- x %= 5;
- }
- while(x >= 2)
- {
- cnt += x / 2;
- x %= 2;
- }
- while(x >= 1)
- {
- cnt += x / 1;
- x %= 1;
- }
- cout << cnt << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement