fork(1) download
  1. import java.util.Arrays;
  2.  
  3. public class Main {
  4.  
  5. public static void main(String[] args) {
  6.  
  7. int mod = 5;
  8.  
  9. for (int a00 = 0; a00 < mod; a00++) {
  10. for (int a01 = 0; a01 < mod; a01++) {
  11. for (int a10 = 0; a10 < mod; a10++) {
  12. for (int a11 = 0; a11 < mod; a11++) {
  13. int[][] a = { { a00, a01 }, { a10, a11 } };
  14.  
  15. int[][] b = pow(a, mod - 1, mod);
  16.  
  17. if (b[0][0] != 1 || b[0][1] != 0 || b[1][0] != 0 || b[1][1] != 1) {
  18. System.out.println(Arrays.deepToString(b));
  19.  
  20. }
  21.  
  22. }
  23. }
  24. }
  25. }
  26.  
  27. }
  28.  
  29. static int[][] pow(int[][] a, int b, int mod) {
  30. int[][] c = { { 1, 0 }, { 0, 1 } };
  31.  
  32. for (; b > 0; b /= 2) {
  33. if (b % 2 == 1) {
  34. c = mul(c, a, mod);
  35. }
  36. a = mul(a, a, mod);
  37. }
  38.  
  39. return c;
  40. }
  41.  
  42. static int[][] mul(int[][] a, int[][] b, int mod) {
  43. int[][] c = new int[2][2];
  44.  
  45. c[0][0] = (a[0][0] * b[0][0] + a[0][1] * b[1][0]) % mod;
  46. c[0][1] = (a[0][0] * b[0][1] + a[0][1] * b[1][1]) % mod;
  47. c[1][0] = (a[1][0] * b[0][0] + a[1][1] * b[1][0]) % mod;
  48. c[1][1] = (a[1][0] * b[0][1] + a[1][1] * b[1][1]) % mod;
  49.  
  50. return c;
  51. }
  52.  
  53. }
Success #stdin #stdout 0.05s 711168KB
stdin
Standard input is empty
stdout
[[0, 0], [0, 0]]
[[0, 0], [0, 1]]
[[0, 0], [0, 1]]
[[0, 0], [0, 1]]
[[0, 0], [0, 1]]
[[0, 0], [0, 0]]
[[0, 0], [1, 1]]
[[0, 0], [3, 1]]
[[0, 0], [2, 1]]
[[0, 0], [4, 1]]
[[0, 0], [0, 0]]
[[0, 0], [2, 1]]
[[0, 0], [1, 1]]
[[0, 0], [4, 1]]
[[0, 0], [3, 1]]
[[0, 0], [0, 0]]
[[0, 0], [3, 1]]
[[0, 0], [4, 1]]
[[0, 0], [1, 1]]
[[0, 0], [2, 1]]
[[0, 0], [0, 0]]
[[0, 0], [4, 1]]
[[0, 0], [2, 1]]
[[0, 0], [3, 1]]
[[0, 0], [1, 1]]
[[0, 0], [0, 0]]
[[0, 1], [0, 1]]
[[0, 3], [0, 1]]
[[0, 2], [0, 1]]
[[0, 4], [0, 1]]
[[2, 3], [3, 0]]
[[0, 2], [2, 4]]
[[0, 3], [3, 4]]
[[2, 2], [2, 0]]
[[4, 0], [0, 4]]
[[2, 1], [2, 4]]
[[2, 4], [3, 4]]
[[4, 0], [0, 4]]
[[2, 2], [1, 4]]
[[2, 3], [4, 4]]
[[0, 4], [1, 4]]
[[2, 4], [1, 0]]
[[2, 1], [4, 0]]
[[0, 1], [4, 4]]
[[0, 0], [0, 0]]
[[0, 2], [0, 1]]
[[0, 1], [0, 1]]
[[0, 4], [0, 1]]
[[0, 3], [0, 1]]
[[4, 0], [0, 4]]
[[2, 2], [1, 4]]
[[2, 3], [4, 4]]
[[0, 3], [3, 4]]
[[2, 3], [3, 0]]
[[2, 2], [2, 0]]
[[0, 2], [2, 4]]
[[2, 1], [4, 0]]
[[0, 4], [1, 4]]
[[0, 1], [4, 4]]
[[2, 4], [1, 0]]
[[4, 0], [0, 4]]
[[2, 4], [3, 4]]
[[2, 1], [2, 4]]
[[0, 0], [0, 0]]
[[0, 3], [0, 1]]
[[0, 4], [0, 1]]
[[0, 1], [0, 1]]
[[0, 2], [0, 1]]
[[4, 0], [0, 4]]
[[2, 1], [2, 4]]
[[2, 4], [3, 4]]
[[2, 4], [1, 0]]
[[0, 1], [4, 4]]
[[0, 4], [1, 4]]
[[2, 1], [4, 0]]
[[0, 2], [2, 4]]
[[2, 2], [2, 0]]
[[2, 3], [3, 0]]
[[0, 3], [3, 4]]
[[4, 0], [0, 4]]
[[2, 3], [4, 4]]
[[2, 2], [1, 4]]
[[0, 0], [0, 0]]
[[0, 4], [0, 1]]
[[0, 2], [0, 1]]
[[0, 3], [0, 1]]
[[0, 1], [0, 1]]
[[0, 1], [4, 4]]
[[2, 1], [4, 0]]
[[2, 4], [1, 0]]
[[0, 4], [1, 4]]
[[4, 0], [0, 4]]
[[2, 3], [4, 4]]
[[2, 2], [1, 4]]
[[4, 0], [0, 4]]
[[2, 4], [3, 4]]
[[2, 1], [2, 4]]
[[2, 2], [2, 0]]
[[0, 3], [3, 4]]
[[0, 2], [2, 4]]
[[2, 3], [3, 0]]
[[1, 0], [0, 0]]
[[1, 0], [1, 0]]
[[1, 0], [4, 1]]
[[1, 0], [2, 0]]
[[1, 0], [3, 1]]
[[1, 0], [3, 0]]
[[1, 0], [2, 1]]
[[1, 0], [4, 0]]
[[1, 0], [1, 1]]
[[1, 1], [0, 0]]
[[1, 4], [0, 1]]
[[0, 3], [3, 2]]
[[3, 3], [3, 3]]
[[3, 1], [1, 4]]
[[0, 3], [3, 1]]
[[4, 0], [0, 4]]
[[2, 2], [4, 2]]
[[2, 2], [4, 4]]
[[1, 1], [2, 3]]
[[4, 0], [0, 4]]
[[4, 2], [1, 2]]
[[3, 1], [3, 3]]
[[3, 3], [4, 1]]
[[4, 4], [2, 2]]
[[4, 4], [1, 0]]
[[1, 4], [1, 0]]
[[4, 2], [3, 3]]
[[0, 0], [0, 0]]
[[1, 2], [0, 0]]
[[1, 3], [0, 1]]
[[2, 4], [2, 2]]
[[2, 4], [2, 4]]
[[1, 2], [1, 3]]
[[4, 0], [0, 4]]
[[4, 3], [3, 0]]
[[1, 3], [3, 0]]
[[4, 4], [4, 3]]
[[0, 0], [0, 0]]
[[0, 1], [4, 2]]
[[3, 1], [4, 3]]
[[3, 2], [3, 4]]
[[0, 1], [4, 1]]
[[4, 0], [0, 4]]
[[4, 4], [3, 2]]
[[3, 2], [4, 3]]
[[3, 1], [2, 1]]
[[4, 3], [1, 2]]
[[1, 3], [0, 0]]
[[1, 2], [0, 1]]
[[4, 1], [2, 2]]
[[3, 3], [1, 3]]
[[3, 4], [3, 1]]
[[4, 2], [4, 2]]
[[0, 4], [1, 2]]
[[3, 4], [1, 3]]
[[3, 3], [2, 4]]
[[0, 4], [1, 1]]
[[4, 0], [0, 4]]
[[4, 2], [2, 0]]
[[1, 2], [2, 0]]
[[4, 1], [1, 3]]
[[0, 0], [0, 0]]
[[2, 1], [3, 2]]
[[2, 1], [3, 4]]
[[1, 3], [4, 3]]
[[4, 0], [0, 4]]
[[1, 4], [0, 0]]
[[1, 1], [0, 1]]
[[4, 1], [4, 0]]
[[1, 1], [4, 0]]
[[4, 3], [2, 3]]
[[0, 0], [0, 0]]
[[4, 3], [4, 2]]
[[3, 4], [2, 3]]
[[3, 2], [1, 1]]
[[4, 1], [3, 2]]
[[2, 3], [1, 2]]
[[2, 3], [1, 4]]
[[1, 4], [3, 3]]
[[4, 0], [0, 4]]
[[0, 2], [2, 2]]
[[3, 2], [2, 3]]
[[3, 4], [4, 4]]
[[0, 2], [2, 1]]
[[4, 0], [0, 4]]
[[1, 0], [0, 0]]
[[1, 0], [3, 0]]
[[1, 0], [2, 1]]
[[1, 0], [1, 0]]
[[1, 0], [4, 1]]
[[1, 0], [4, 0]]
[[1, 0], [1, 1]]
[[1, 0], [2, 0]]
[[1, 0], [3, 1]]
[[1, 3], [0, 0]]
[[1, 2], [0, 1]]
[[4, 2], [2, 0]]
[[4, 1], [1, 3]]
[[0, 0], [0, 0]]
[[1, 2], [2, 0]]
[[4, 1], [2, 2]]
[[4, 2], [4, 2]]
[[3, 3], [1, 3]]
[[3, 4], [3, 1]]
[[1, 3], [4, 3]]
[[2, 1], [3, 2]]
[[4, 0], [0, 4]]
[[2, 1], [3, 4]]
[[0, 4], [1, 2]]
[[0, 4], [1, 1]]
[[3, 4], [1, 3]]
[[4, 0], [0, 4]]
[[3, 3], [2, 4]]
[[1, 1], [0, 0]]
[[1, 4], [0, 1]]
[[4, 2], [1, 2]]
[[4, 4], [2, 2]]
[[3, 1], [3, 3]]
[[3, 3], [4, 1]]
[[0, 3], [3, 2]]
[[0, 3], [3, 1]]
[[3, 3], [3, 3]]
[[4, 0], [0, 4]]
[[3, 1], [1, 4]]
[[4, 4], [1, 0]]
[[4, 2], [3, 3]]
[[0, 0], [0, 0]]
[[1, 4], [1, 0]]
[[1, 1], [2, 3]]
[[2, 2], [4, 2]]
[[4, 0], [0, 4]]
[[2, 2], [4, 4]]
[[1, 4], [0, 0]]
[[1, 1], [0, 1]]
[[1, 4], [3, 3]]
[[2, 3], [1, 2]]
[[4, 0], [0, 4]]
[[2, 3], [1, 4]]
[[4, 1], [4, 0]]
[[4, 3], [2, 3]]
[[0, 0], [0, 0]]
[[1, 1], [4, 0]]
[[0, 2], [2, 2]]
[[0, 2], [2, 1]]
[[3, 2], [2, 3]]
[[4, 0], [0, 4]]
[[3, 4], [4, 4]]
[[4, 3], [4, 2]]
[[4, 1], [3, 2]]
[[3, 4], [2, 3]]
[[3, 2], [1, 1]]
[[1, 2], [0, 0]]
[[1, 3], [0, 1]]
[[0, 1], [4, 2]]
[[0, 1], [4, 1]]
[[3, 1], [4, 3]]
[[4, 0], [0, 4]]
[[3, 2], [3, 4]]
[[1, 2], [1, 3]]
[[2, 4], [2, 2]]
[[4, 0], [0, 4]]
[[2, 4], [2, 4]]
[[4, 4], [3, 2]]
[[4, 3], [1, 2]]
[[3, 2], [4, 3]]
[[3, 1], [2, 1]]
[[4, 3], [3, 0]]
[[4, 4], [4, 3]]
[[0, 0], [0, 0]]
[[1, 3], [3, 0]]
[[1, 0], [0, 0]]
[[1, 0], [2, 0]]
[[1, 0], [3, 1]]
[[1, 0], [4, 0]]
[[1, 0], [1, 1]]
[[1, 0], [1, 0]]
[[1, 0], [4, 1]]
[[1, 0], [3, 0]]
[[1, 0], [2, 1]]
[[1, 2], [0, 0]]
[[1, 3], [0, 1]]
[[4, 3], [3, 0]]
[[1, 3], [3, 0]]
[[0, 0], [0, 0]]
[[4, 4], [4, 3]]
[[4, 4], [3, 2]]
[[3, 1], [2, 1]]
[[3, 2], [4, 3]]
[[4, 3], [1, 2]]
[[2, 4], [2, 4]]
[[4, 0], [0, 4]]
[[2, 4], [2, 2]]
[[1, 2], [1, 3]]
[[0, 1], [4, 2]]
[[3, 2], [3, 4]]
[[4, 0], [0, 4]]
[[3, 1], [4, 3]]
[[0, 1], [4, 1]]
[[1, 4], [0, 0]]
[[1, 1], [0, 1]]
[[4, 3], [4, 2]]
[[3, 2], [1, 1]]
[[3, 4], [2, 3]]
[[4, 1], [3, 2]]
[[0, 2], [2, 2]]
[[3, 4], [4, 4]]
[[4, 0], [0, 4]]
[[3, 2], [2, 3]]
[[0, 2], [2, 1]]
[[4, 1], [4, 0]]
[[1, 1], [4, 0]]
[[0, 0], [0, 0]]
[[4, 3], [2, 3]]
[[2, 3], [1, 4]]
[[4, 0], [0, 4]]
[[2, 3], [1, 2]]
[[1, 4], [3, 3]]
[[1, 1], [0, 0]]
[[1, 4], [0, 1]]
[[2, 2], [4, 4]]
[[4, 0], [0, 4]]
[[2, 2], [4, 2]]
[[1, 1], [2, 3]]
[[4, 4], [1, 0]]
[[1, 4], [1, 0]]
[[0, 0], [0, 0]]
[[4, 2], [3, 3]]
[[0, 3], [3, 2]]
[[3, 1], [1, 4]]
[[4, 0], [0, 4]]
[[3, 3], [3, 3]]
[[0, 3], [3, 1]]
[[4, 2], [1, 2]]
[[3, 3], [4, 1]]
[[3, 1], [3, 3]]
[[4, 4], [2, 2]]
[[1, 3], [0, 0]]
[[1, 2], [0, 1]]
[[0, 4], [1, 2]]
[[3, 3], [2, 4]]
[[4, 0], [0, 4]]
[[3, 4], [1, 3]]
[[0, 4], [1, 1]]
[[2, 1], [3, 4]]
[[4, 0], [0, 4]]
[[2, 1], [3, 2]]
[[1, 3], [4, 3]]
[[4, 1], [2, 2]]
[[3, 4], [3, 1]]
[[3, 3], [1, 3]]
[[4, 2], [4, 2]]
[[4, 2], [2, 0]]
[[1, 2], [2, 0]]
[[0, 0], [0, 0]]
[[4, 1], [1, 3]]
[[1, 0], [0, 0]]
[[1, 0], [4, 0]]
[[1, 0], [1, 1]]
[[1, 0], [3, 0]]
[[1, 0], [2, 1]]
[[1, 0], [2, 0]]
[[1, 0], [3, 1]]
[[1, 0], [1, 0]]
[[1, 0], [4, 1]]
[[1, 4], [0, 0]]
[[1, 1], [0, 1]]
[[0, 2], [2, 2]]
[[4, 0], [0, 4]]
[[0, 2], [2, 1]]
[[3, 4], [4, 4]]
[[3, 2], [2, 3]]
[[4, 0], [0, 4]]
[[1, 4], [3, 3]]
[[2, 3], [1, 4]]
[[2, 3], [1, 2]]
[[4, 3], [4, 2]]
[[4, 1], [3, 2]]
[[3, 2], [1, 1]]
[[3, 4], [2, 3]]
[[4, 1], [4, 0]]
[[0, 0], [0, 0]]
[[4, 3], [2, 3]]
[[1, 1], [4, 0]]
[[1, 3], [0, 0]]
[[1, 2], [0, 1]]
[[4, 0], [0, 4]]
[[1, 3], [4, 3]]
[[2, 1], [3, 4]]
[[2, 1], [3, 2]]
[[4, 2], [2, 0]]
[[0, 0], [0, 0]]
[[4, 1], [1, 3]]
[[1, 2], [2, 0]]
[[0, 4], [1, 2]]
[[4, 0], [0, 4]]
[[0, 4], [1, 1]]
[[3, 3], [2, 4]]
[[3, 4], [1, 3]]
[[4, 1], [2, 2]]
[[4, 2], [4, 2]]
[[3, 4], [3, 1]]
[[3, 3], [1, 3]]
[[1, 2], [0, 0]]
[[1, 3], [0, 1]]
[[4, 4], [3, 2]]
[[4, 3], [1, 2]]
[[3, 1], [2, 1]]
[[3, 2], [4, 3]]
[[0, 1], [4, 2]]
[[4, 0], [0, 4]]
[[0, 1], [4, 1]]
[[3, 2], [3, 4]]
[[3, 1], [4, 3]]
[[4, 3], [3, 0]]
[[0, 0], [0, 0]]
[[4, 4], [4, 3]]
[[1, 3], [3, 0]]
[[4, 0], [0, 4]]
[[1, 2], [1, 3]]
[[2, 4], [2, 4]]
[[2, 4], [2, 2]]
[[1, 1], [0, 0]]
[[1, 4], [0, 1]]
[[4, 4], [1, 0]]
[[0, 0], [0, 0]]
[[4, 2], [3, 3]]
[[1, 4], [1, 0]]
[[4, 2], [1, 2]]
[[4, 4], [2, 2]]
[[3, 3], [4, 1]]
[[3, 1], [3, 3]]
[[4, 0], [0, 4]]
[[1, 1], [2, 3]]
[[2, 2], [4, 4]]
[[2, 2], [4, 2]]
[[0, 3], [3, 2]]
[[4, 0], [0, 4]]
[[0, 3], [3, 1]]
[[3, 1], [1, 4]]
[[3, 3], [3, 3]]