- 博客(12)
- 资源 (1)
- 收藏
- 关注
原创 Section 1.3 Barn Reapir
贪心算法,思路不难但在提交过程中发现很多bug: 1.得到需要“切板”的位置后,应该按num排序 2.当M == 1时要特别处理,否则number为空向量,程序异常退出 3.输入牛的位置是无序的,要先按num升序排序 4.当M > C的时候,number个数应该为min(M,C)/*
2016-08-31 14:45:19 315
翻译 Section 1.3 Greedy Algorithm
The basic idea behind greedy algorithms is to build large solutions up from smaller ones. Unlike other approaches, however, greedy algorithms keep only the best solution they find as they go along.
2016-08-29 23:21:22 521
原创 Section 1.2 Name That Number
一个匹配搜索的问题,不过是我第一次写从文件中即时读取即时搜索。 开始的思路是通过input把number转为name,再进行搜索,后来发现这样不仅费时而且浪费空间;于是采用了把data.txt中的name转化为number,依次与input匹配的方法。
2016-08-20 00:07:01 291
原创 Machine Learning--logistic regression
本文参考http://blog.csdn.net/xiahouzuoxin/article/details/44959205 在此向原作者致谢当y的取值离散时,linear regression algorithm不再适用,而应该选择logistic regression. 下图是logistic function(or sigmoid function):下面是matlab代码:functio
2016-08-18 21:51:02 401
原创 Section 1.2 Transformations
这道搜索题没什么绕弯的地方,把transformation用矩阵位置变换表示,然后一一验证即可。对于#5 combination我写得比较啰嗦: )/*ID: alexyua2PROG: transformLANG: C++*/#include<fstream>using namespace std;ifstream fin("transform.in");ofstream fout("
2016-08-14 22:43:56 211
原创 Section 1.2 Milking Cows
做的第一个模拟时间轴的问题,关键在于search部分的对于t1,t2的不断变化。 也通过这一题学习了algorithm中的sort函数使用。/*ID: alexyua2PROG: milk2LANG: C++*/#include<fstream>#include<algorithm>#include<vector>using namespace std;ifstream fin("
2016-08-14 21:54:13 249
OpenMP实现计算pi值和PSRS排序并行计算实验
2019-05-08
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人