Simplied a DFS\BFS with minor modification.#include #include #include #include #include #include using namespace std;typedef vector> Matrix;typedef pa...
分类:
其他好文 时间:
2015-04-27 14:51:51
阅读次数:
106
主要讲的各个基本类型,integer,float,list,tuple,dic, list method:append,insert,extend, index tuple:no method ,can not change it,bu we can use the index to travel across dic: create a dic by using di...
分类:
编程语言 时间:
2015-04-27 13:24:59
阅读次数:
168
公式很简单,就是初值要处理好就可以了
#include
#include
#include
using namespace std;
const int inf=9999999;
int s[2005],d[2005],dp[2005][2];//dp[i][0]第i个数独立处理时,前i个数的最大值 dp[i][1]第i个数和前面的数一起处理时,前i个数的最大值
int main(){
...
分类:
其他好文 时间:
2015-04-27 13:19:24
阅读次数:
103
分析:大数模拟和找规律。
#include
using namespace std;
char f[1001][501];
/*
从下面的步骤中可以看出,下一步的后半部分是前一步的整个串,所以对于后半部分有f[n]=f[n-1];
从前半部分和整体可以看出,另一部分有f[n]=f[n-1]-1(奇数步),f[n]=f[n-1]+1(偶数步)。
step0:1 ...
分类:
其他好文 时间:
2015-04-27 13:16:17
阅读次数:
117
《1》
控制器
using System;
using System.Collections.Generic;
using System.Data.Entity.Infrastructure;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Script.Serialization;
na...
分类:
Web程序 时间:
2015-04-27 13:15:04
阅读次数:
211
As a response for customer's question, I decided to write about using Like Operator in Linq to SQL queries.Starting from a simple query from Northwind...
分类:
数据库 时间:
2015-04-27 12:33:41
阅读次数:
183
//问题:
//给你一个数组,a[]={1,1,1,1,1,2,2,2,2,3,3,3,4,5,6}
//要输出的结果是1,2,3,4,5,6.(去除重复的数字,要求时间空间的考虑).
#include
using namespace std;
struct Node
{
int data;
Node *next;
Node():data(-1),next(NULL){}
};
//...
分类:
编程语言 时间:
2015-04-27 11:24:07
阅读次数:
179
#include
#include
#define SIZE 10
#define MAXVALUE 0x7fffffff
using namespace std;
//题目是:求一个字符串中最小字串.
//求最小字串,比求最大字串难的多,下面有我的求最大字串代码,我没有想到更好的方法,下面的这个方法虽然空间复杂度太大,可是时间复杂度是比较快的。
template
struct Node
{...
分类:
编程语言 时间:
2015-04-27 11:23:56
阅读次数:
185
分析:简单DP,转移方程dp[j]=max{dp[i]}+a[j];(0
#include
using namespace std;
__int64 dp[1001];
int a[1001];
int main()
{
int i,n,j;
__int64 max;
while(cin>>n && n)
{
for(i=0;i>a[i];
...
分类:
其他好文 时间:
2015-04-27 11:19:54
阅读次数:
100
#include
using namespace std;
class Animal
{
private:
char name[20];
protected:
int age;
public:
void setName(char *name)
{
strcpy_s(this->name,name);
}
void setAge(int age)
{
this->age=age...
分类:
编程语言 时间:
2015-04-27 11:13:40
阅读次数:
188