poj 3070 矩阵快速乘

  1. #include <map>
  2. #include <stdio.h>
  3. #include <iostream>
  4. using namespace std;
  5. void multiple ( int x[2][2], int y[2][2] )
  6. {
  7. int temp[2][2]
  8. temp[0][0] = (;x[0][0]*y[0][0]+x[0][1]*y[1][0])%10000;
  9. temp[0][1] = (x[0][0]*y[0][1]+x[0][1]*y[1][1])%10000;
  10. temp[1][0] = (x[1][0]*y[0][0]+x[1][1]*y[1][0])%10000;
  11. temp[1][1] = (x[1][0]*y[0][1]+x[1][1]*y[1][1])%10000;
  12. x[0][0] = temp[0][0];
  13. x[0][1] = temp[0][1];
  14. x[1][0] = temp[1][0];
  15. x[1][1] = temp[1][1];
  16. }
  17. int main()
  18. {
  19. int n;
  20. while( ~scanf("%d", &n) )
  21. {
  22. int x[2][2] =
  23. { 1, 1,
  24. 1, 0
  25. };
  26. int y[2][2] =
  27. { 1, 0,
  28. 0, 1
  29. };
  30. if(n == 0) printf("0 ");
  31. else
  32. {
  33. for(; n>0; n /=2)
  34. }
  35. }
  36. return 0;
  37. }





附件列表

    原文地址:https://www.cnblogs.com/sober-reflection/p/79e9e315df007161f6c7413c408ed1b1.html