SHARE
TWEET

Untitled

a guest Nov 22nd, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     long long int t, a, b;
  9.     cin >> t;
  10.    
  11.     int cycles[10][4] = {
  12.         {0, 0, 0, 0},
  13.         {1, 1, 1, 1},
  14.         {2, 4, 8, 6},
  15.         {3, 9, 7, 1},
  16.         {4, 6, 4, 6},
  17.         {5, 5, 5, 5},
  18.         {6, 6, 6, 6},
  19.         {7, 9, 3, 1},
  20.         {8, 4, 2, 6},
  21.         {9, 1, 9, 1}};
  22.        
  23.    
  24.     while (t > 0) {
  25.         cin >> a >> b;
  26.        
  27.         a %= 10;
  28.         b %= 4;
  29.        
  30.         cout << cycles[a][b-1] << endl;
  31.      
  32.         t--;  
  33.     }
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top