主页
went
wenti
osx镜像
mirrors
with-mobx-state-tree-typescript
with-mobx-state-tree-typescript
c++版牛顿开方递归版
#include <iostream> #include <iomanip> using namespace std; int a=1; //绝对值函数 double abs(const double& a, const double& b){ return a > b ? a-b : b-a; } //求平均数 double average(const double& a, const double& b){ return (a+b)/2; } void _iter(double guess , double x, double& res){ if(abs(x,guess*guess) < 0.0001){ res= guess; } else{ _iter(average(x/guess, guess), x, res); } } //牛顿法求平方根 double sqroot(double n){ double res; _iter(1.0, n, res); return res; } int main(){ double x1, y1, x2, y2; cin >> x1>>y1; cin >>x2>>y2; double around = abs(x2, x1); double ver = abs(y2, y1); cout << fixed << setprecision(3)<< sqroot(around*around+ver*ver) << endl; return 0; }
动态规划之自底向上
#include <iostream> using namespace std; //动态规划 int fib(int n){ if(n<2) return n; return fib(n-1) + fib(n-2); } // 由下向上迭代 void fib(int& pre, int& next, int n){ int i = 0; while(i<n){ int temp = pre; pre = next; next = temp + next; i++; } } int main(){ int n, pre=0, next=1; cin >> n; fib(pre, next, n); cout << next; return 0; }
缩放gnome
gsettings set org.gnome.desktop.interface scaling-factor 2
深度搜索查表和二路递归
#include <iostream> template<class T> T Max(const T& a, const T& b){ return a>b ? a : b; } using namespace std; int Tree[50][50], N, Sum; int deep_find_search(int x, int y, int C){ if(x == N){ if(C > Sum) Sum = C; return Sum; } deep_find_search(x+1, y, C+Tree[x+1][y]); deep_find_search(x+1, y+1, C+Tree[x+1][y+1]); } int A[50][50], B[50][50]; //查表 int dps(int x, int y){ if(!!B[x][y]) return B[x][y]; if(x==N) B[x][y] = A[x][y]; else B[x][y] = A[x][y] + Max(dps(x+1, y), dps(x+1, y+1)); return B[x][y]; } int main(){ cin >> N; for(int i=1; i<=N; i++){ cout<< "\n"; for(int j=1; j <= i; j++) cout << Tree[j][i]; } return 0; }
网页设计资源
css动画icss mit学术网站借鉴bosefellows
git 更新gitignore并同步远程仓库
git rm -r --cached . git add -A git commit -m "update .gitignore"