/* * vectorDemo.cpp * * Created on: Jul 17, 2014 * Author: lichfeng */#include#include #include #include"vectorDemo.H"using namespace std;void v...
分类:
其他好文 时间:
2014-07-19 15:39:21
阅读次数:
201
class Solution {public: vector generateParenthesis(int n) { string str; vector res; dfs(n, 0, 0, str, res); return res;...
分类:
其他好文 时间:
2014-07-19 15:28:21
阅读次数:
207
本章介绍Java的实用工具类库java.util包。在这个包中,Java提供了一些实用的方法和数据结构。例如,Java提供日期(Data)类、日 历(Calendar)类来产生和获取日期及时间,提供随机数(Random)类产生各种类型的随机数,还提供了堆栈(Stack)、向量 (Vector) 、位...
分类:
编程语言 时间:
2014-07-19 15:10:44
阅读次数:
337
C++内置的数组支持容器的机制,可是它不支持容器抽象的语义。要解决此问题我们自己实现这种类。在标准C++中,用容器向量(vector)实现。容器向量也是一个类模板。标准库vector类型使用须要的头文件:#include 。vector 是一个类模板。不是一种数据类型,vector是一种数据类型。V...
分类:
编程语言 时间:
2014-07-19 15:07:52
阅读次数:
252
题目链接:点击打开链接
3个数为一组,找最大的一个数让它减少,则显然是有解的,分类讨论一下即可
#include
#include
#include
#include
#include
using namespace std;
int n, k;
int a[4];
vector >ans;
int maxpos(){
int pos = 0;
for(int i = 1; i < 4; ...
分类:
其他好文 时间:
2014-07-19 08:21:07
阅读次数:
227
class Solution {public: void setZeroes(vector > &matrix) { int rows = matrix.size(); int cols = matrix[0].size(); bool...
分类:
其他好文 时间:
2014-07-19 00:10:42
阅读次数:
177
class Solution {private: int queen_num; int total;public: int totalNQueens(int n) { queen_num = n; total = 0; vector h(n...
分类:
其他好文 时间:
2014-07-18 16:12:55
阅读次数:
210
题目链接:http://code.bupt.edu.cn/problem/p/427/
一个很单纯的every-sg模型
代码:
#include
#include
#include
#include
#define N 100010
using namespace std;
int step[N];
int sg[N];
int stone[N];
vector g[N];
i...
分类:
其他好文 时间:
2014-07-18 11:34:05
阅读次数:
173
最短路+DP(个人用的SPFA+完全背包)
做了一上午……开始想用SPFA+BFS。但是写了半天越写越乱,放弃了。
就想到了是不是可以当作背包问题(背出病了……)把鞋子可以使用的次数当作背包容量。做完全背包。
先N次SPFA把 各点的最短距离算出来,其实比较适合Floyd。(个人用vector实现伪邻接表,然后SPFA)
然后SPFA更新路径的时候,当鞋子使用次数不...
分类:
其他好文 时间:
2014-07-18 11:18:36
阅读次数:
279