Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- long long int t, a, b;
- cin >> t;
- int cycles[10][4] = {
- {0, 0, 0, 0},
- {1, 1, 1, 1},
- {2, 4, 8, 6},
- {3, 9, 7, 1},
- {4, 6, 4, 6},
- {5, 5, 5, 5},
- {6, 6, 6, 6},
- {7, 9, 3, 1},
- {8, 4, 2, 6},
- {9, 1, 9, 1}};
- while (t > 0) {
- cin >> a >> b;
- a %= 10;
- b %= 4;
- cout << cycles[a][b-1] << endl;
- t--;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement