摘要: ::目录 ::--DP-----STL-----递推&找规律-----模拟-----数据结构-----贪心-----图论-----其它--- 阅读全文
posted @ 2013-01-28 11:41 about:blank 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 创建string对象#include <string>#include <iostream>using namespace std;int main(){ string s; cout<<s.length()<<endl; return 0;}/* 运行结果 0*/给sting对象赋值#include <string>#include <iostream>using namespace std;int main(){ string s; s ="2013 1 4"; cout<<s<& 阅读全文
posted @ 2013-01-05 14:29 about:blank 阅读(148) 评论(0) 推荐(0) 编辑
摘要: 用 vector 向量容器装入十个整数#装入10个整数,然后用迭代器 iterator 和 accumulate 算法统计出这十个元素的和。#include <iostinclude <vector>#include <numeric> // accumulate需要using namespace std;int main(){ vector<int> v; int i; for (i=0; i<10; i++) { //尾部扩张方式赋值 v.push_back(i); } // 使用 iterator 迭代器顺序遍历所有元... 阅读全文
posted @ 2013-01-05 11:14 about:blank 阅读(227) 评论(0) 推荐(0) 编辑
摘要: HDU 1254推箱子题意:图中有一个箱子,和目标点,问最少推多少步可以把箱子推到目的地。分析:广搜+深搜,对箱子的移动进行广搜处理,广搜的过程中用深搜判断人能否到达推箱子的位置。HDU 1254#include <stdio.h>#include <string.h>#define clr(x)memset(x,0,sizeof(x))int f[8] = {-1,1,0,0, 0,0,-1,1};struct node{ int step; int x, y; int tx, ty;}q[8000],tt,end,in,re;int v[8][8][8][8];in 阅读全文
posted @ 2012-12-27 07:24 about:blank 阅读(412) 评论(0) 推荐(0) 编辑