Advertisement
Guest User

Untitled

a guest
Jul 27th, 2014
580
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. /*
  2. */
  3.  
  4. //#pragma comment(linker, "/STACK:16777216")
  5. #include <fstream>
  6. #include <iostream>
  7. #include <string>
  8. #include <complex>
  9. #include <math.h>
  10. #include <set>
  11. #include <vector>
  12. #include <map>
  13. #include <queue>
  14. #include <stdio.h>
  15. #include <stack>
  16. #include <algorithm>
  17. #include <list>
  18. #include <ctime>
  19. //#include <memory.h>
  20.  
  21. #define y0 sdkfaslhagaklsldk
  22. #define y1 aasdfasdfasdf
  23. #define yn askfhwqriuperikldjk
  24. #define j1 assdgsdgasghsf
  25. #define tm sdfjahlfasfh
  26. #define lr asgasgash
  27.  
  28. #define eps 1e-14
  29. //#define M_PI 3.141592653589793
  30. #define bs 1000000009
  31. #define bsize 256
  32. //#define N 120000
  33.  
  34. using namespace std;
  35.  
  36. long n;
  37. double prob[201][201];
  38.  
  39. double temp[201][201],temp1[201][201];
  40.  
  41. void mult(double v[201][201], long n)
  42. {
  43.  
  44. for (int i=0;i<n;i++)
  45. for (int j=0;j<n;j++)
  46. temp[i][j]=temp1[j][i]=v[i][j],v[i][j]=0;
  47.  
  48. for (int i=0;i<n;i++)
  49. for (int j=0;j<n;j++)
  50. for (int k=0;k<n;k++)
  51. v[i][j]+=temp[i][k]*temp1[j][k];
  52.  
  53. for (int i=0;i<n;i++)
  54. for (int j=0;j<n;j++)
  55. if (v[i][j]<1e-20)v[i][j]=0;
  56. }
  57.  
  58. int main(){
  59. //freopen("magic.in","r",stdin);
  60. //freopen("magic.out","w",stdout);
  61. //freopen("C:/input.txt","r",stdin);
  62. //freopen("C:/output.txt","w",stdout);
  63. ios_base::sync_with_stdio(0);
  64. //cin.tie(0);
  65.  
  66. n = 200;
  67. for (int i=0;i<n;i++)
  68. for (int j=0;j<n;j++)
  69. prob[i][j]=rand()%1000*0.001;
  70.  
  71. for (int iter=1;iter<=8;iter++)
  72. mult(prob,n);
  73.  
  74. cin.get();cin.get();
  75. return 0;}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement