2012年11月2日

TSP问题_遗传算法(STL大量使用)

摘要: #include#include#include//random_shuffle();sort();lower_bound();#include#includeusing namespace std;typedef vector VI;typedef vector VVI;#define PB push_back //在vector尾部加入一个数据#define MP make_pair //1.将2个数据组合成一个数据//2.当一个函数需要返回2个数据的时候,可以选择pair//pair的实现是一个结构体,主要的两个成员变量是first、second //因为是使用struct不是class 阅读全文

posted @ 2012-11-02 10:48 IThinktan 阅读(753) 评论(0) 推荐(0) 编辑

单词倒排

摘要: 单词倒排(一)#include<stdio.h>#include<string.h>int main(){ int i,j; char a[20][20]={0},b[1][20]={0};//字符数组创建时就立即初始化为全0(即ASCI值0---对应字符'\0') for(i=0;i<20;i++) { int flag=0; for(j=0;;)//一个字符串的输入 { char C=getchar(); if(C=='\n') { flag=1; break; }... 阅读全文

posted @ 2012-11-02 09:54 IThinktan 阅读(1487) 评论(0) 推荐(0) 编辑

导航