昨天看到一个同行的博客,放在github pages上。我对静态博客这种形式很有兴趣,因为Markdown写起来比较方便,而自己不需要考虑主题什么的。于是自己也来配置一下。
碰巧在网上看到了Hexo,是基于NodeJS做的,还比较熟,于是尝试在Cloud 9上配置了环境,生成了这个Blog。
目前整个项目放在Cloud 9上面,使用云端IDE编辑,免去配置环境等麻烦。4
尝试高亮1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
| #include <cmath> #include <cstdio> #include <vector> #include <string> #include <sstream> #include <fstream> #include <iostream> #include <algorithm> using namespace std;
class mixture{ public: double c; vector<double> mean; vector<double> variance; };
class speaker{ public: vector<mixture*> l; string name; speaker(){ } speaker(string s):name(s){ } };
vector<speaker*> H;
int main(){ ifstream fin("TEST_MMF"); string s; double t;
speaker *p; mixture *q; while(getline(fin,s)){ if(s.substr(0,2)=="~h"){ s=s.substr(s.find("\"")+1); s=s.substr(0,s.length()-1); p=new speaker(s); H.push_back(p); } if(s.substr(0,9)=="<MIXTURE>"){ int id; s=s.substr(9); istringstream istr(s); istr>>id>>t; q = new mixture(); q -> c = t; p -> l.push_back(q); } if(s.substr(0,6)=="<MEAN>"){ getline(fin,s); istringstream istr; istr.str(s); while(istr>>t)q->mean.push_back(t); } if(s.substr(0,10)=="<VARIANCE>"){ getline(fin,s); istringstream istr(s); while(istr>>t)q->variance.push_back(t); } } for(int i=0;i<H.size();++i) for(int j=0;j<H[i]->l.size();++j){ double cc = H[i]->l[j]->c; cc = sqrt(cc); for(int k=0;k<H[i]->l[j]->mean.size();++k) H[i]->l[j]->mean[k]*=cc*H[i]->l[j]->variance[k]; } for(int i=0;i<H.size();++i){ cout<<H[i]->name.substr(3); int cnt=0; for(int j=0;j<H[i]->l.size();++j) for(int k=0;k<H[i]->l[j]->mean.size();++k) cout<<" "<<++cnt<<":"<<H[i]->l[j]->mean[k]; cout<<endl; } return 0; }
|
尝试高亮1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
| #include <cmath> #include <cstdio> #include <vector> #include <string> #include <sstream> #include <fstream> #include <iostream> #include <algorithm> using namespace std;
class mixture{ public: double c; vector<double> mean; vector<double> variance; };
class speaker{ public: vector<mixture*> l; string name; speaker(){ } speaker(string s):name(s){ } };
vector<speaker*> H;
int main(){ ifstream fin("TEST_MMF"); string s; double t;
speaker *p; mixture *q; while(getline(fin,s)){ if(s.substr(0,2)=="~h"){ s=s.substr(s.find("\"")+1); s=s.substr(0,s.length()-1); p=new speaker(s); H.push_back(p); } if(s.substr(0,9)=="<MIXTURE>"){ int id; s=s.substr(9); istringstream istr(s); istr>>id>>t; q = new mixture(); q -> c = t; p -> l.push_back(q); } if(s.substr(0,6)=="<MEAN>"){ getline(fin,s); istringstream istr; istr.str(s); while(istr>>t)q->mean.push_back(t); } if(s.substr(0,10)=="<VARIANCE>"){ getline(fin,s); istringstream istr(s); while(istr>>t)q->variance.push_back(t); } } for(int i=0;i<H.size();++i) for(int j=0;j<H[i]->l.size();++j){ double cc = H[i]->l[j]->c; cc = sqrt(cc); for(int k=0;k<H[i]->l[j]->mean.size();++k) H[i]->l[j]->mean[k]*=cc*H[i]->l[j]->variance[k]; } for(int i=0;i<H.size();++i){ cout<<H[i]->name.substr(3); int cnt=0; for(int j=0;j<H[i]->l.size();++j) for(int k=0;k<H[i]->l[j]->mean.size();++k) cout<<" "<<++cnt<<":"<<H[i]->l[j]->mean[k]; cout<<endl; } return 0; }
|