SHARE
TWEET

Untitled

a guest Jul 27th, 2014 453 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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 temp[201][201],temp1[201][201];
  38. vector<vector<double> > prob;
  39.  
  40. void mult(vector<vector<double> > v, long n)
  41. {
  42.  
  43.  for (int i=0;i<n;i++)
  44.   for (int j=0;j<n;j++)
  45.    temp[i][j]=temp1[j][i]=v[i][j],v[i][j]=0;
  46.  
  47.  for (int i=0;i<n;i++)
  48.   for (int j=0;j<n;j++)
  49.    for (int k=0;k<n;k++)
  50.     v[i][j]+=temp[i][k]*temp1[j][k];
  51.  
  52.  for (int i=0;i<n;i++)
  53.   for (int j=0;j<n;j++)
  54.    if (v[i][j]<1e-20)v[i][j]=0;
  55. }
  56.  
  57. int main(){
  58. //freopen("magic.in","r",stdin);
  59. //freopen("magic.out","w",stdout);
  60. //freopen("C:/input.txt","r",stdin);
  61. //freopen("C:/output.txt","w",stdout);
  62. ios_base::sync_with_stdio(0);
  63. //cin.tie(0);
  64.  
  65. n = 200;
  66. prob.resize(201);
  67. for (int i=0;i<201;i++) prob[i].resize(201);
  68.  
  69. for (int i=0;i<n;i++)
  70.  for (int j=0;j<n;j++)
  71.   prob[i][j]=rand()%1000*0.001;
  72.  
  73. for (int iter=1;iter<=50;iter++)
  74.  mult(prob,n);
  75.  
  76. cin.get();cin.get();
  77. return 0;}
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top