#include #include #include #include using namespace std;void StringSplit(const string& str,vector& vStr,const char& division){ int startPos = 0; int e...
分类:
其他好文 时间:
2014-08-17 00:57:21
阅读次数:
345
整个看FFT过程中复数一直很折磨我。原本的实数的东西通过复数表达很像旋转矩阵用quaternion来表达,尽管旋转vector还是要用matrix来做,但是通过用quaternion表达的旋转意义可以做插值等很多快速的操作,而且内存消耗也小,在做完这些操作之后再转成matrix用就好了。复数表达也是...
分类:
其他好文 时间:
2014-08-16 21:00:41
阅读次数:
190
O(n^2) is a naive solution. As rule of thumb, there must be O(n) soluion. Yes - greedy (WHY?)class Solution {public: int maxArea(vector &height) ...
分类:
其他好文 时间:
2014-08-16 15:04:30
阅读次数:
153
Simply DFS + Backtrace, as N-Queenclass Solution {public: vector> rows; vector> cols; vector>> subboxHm; bool isValid(char c, int i, int j...
分类:
其他好文 时间:
2014-08-16 07:29:10
阅读次数:
166
1. 插入排序(1) 直接插入排序void StraightInsertionSort(std::vector& num) { if (num.size() == 0 || num.size() == 1) return; for (int i = 1; i = 0 && num.at(...
分类:
其他好文 时间:
2014-08-15 22:24:29
阅读次数:
412
题目链接
题意:给你n个数,要求按照题目所给的规则大小排序,输出所有可能的结果。
思路:其实求出来的所有序列是n个数的全排列,那么难点在于怎么按照题目所给的格式输出。我们可以看出其实是在已知的序列上插空,所以就可以使用回溯来插入元素,这里可以使用vector,方便元素的插入。
#include
#include
#include
#include
#include...
分类:
其他好文 时间:
2014-08-15 21:11:09
阅读次数:
173
#include #include #include int main(){ using namespace std; int casts[10]={6,7,2,9,4,11,8,7,10,5}; vector dice(10); copy(casts,casts+10,di...
分类:
其他好文 时间:
2014-08-15 20:57:09
阅读次数:
195
POJ 3671
题意:要使序列形成非递减的序列,最少改变几个数;
思路:ans=n-lis();
#include
#include
#include
#include
#include
#include
using namespace std;
int n;
int cow[30010];
vector len; //len[k]=t,表示k长度的序列的最小...
分类:
其他好文 时间:
2014-08-15 17:59:59
阅读次数:
215
Given a set of distinct integers, S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not c...
分类:
其他好文 时间:
2014-08-15 17:18:39
阅读次数:
177
inifile 一个轻量级的INI文件解析库:ini文件是一种常见的配置文件。它以简单的文字与简单的结构组成.INI文件会以不同的扩展名,如".ini.",".cfg".INI文件由3个重要的部分组成:参数(parameters),段(sections)和注释(comments).IniFile库既包含了INI文件的解析,也能够修改并保存INI文件。解析过程中如果INI文件中没有指定段名,则会指定一个空字符串作为段名,段采用map保存,而段中的参数则采用vector保存,因此支持参数名重复。IniFile除...
分类:
其他好文 时间:
2014-08-15 14:46:08
阅读次数:
238