Guest User

Untitled

a guest
Jan 12th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.27 KB | None | 0 0
  1. Matr P[35];
  2.  
  3. Matr power(Matr A, int p) {
  4.     Matr x = IdMatr;
  5.     x.m = x.n = A.m;
  6.    
  7.     int i = 0;
  8.     while(p > 0) {
  9.         if(p % 2) x = x * P[i];
  10.         i++;
  11.         p /= 2;
  12.     }
  13.     re x;
  14. }
  15.  
  16. // ....
  17. // in main()...
  18.  
  19. P[0] = Gen;
  20.     FOR(i,1,34)
  21.         P[i] = P[i-1] * P[i-1];
  22.  
  23. // ....
Add Comment
Please, Sign In to add comment