摘要:
#include<iostream>#include<queue>using namespace std;char a[205][205],guodu[205][205];int t[205][205],guodu2[205][205];int map[4][2]={{1,0},{0,1},{0,-1},{-1,0}};int x,y,counter;struct node... 阅读全文
posted @ 2010-05-12 11:01
VRS
阅读(336)
评论(0)
推荐(0)
摘要:
//////////////////////////////////////////////////////用鸽巢原理#include<iostream>using namespace std; int buc[1005];int main(){ int N,Q; while(cin>>N>>Q && !(N==0 && Q==0... 阅读全文
posted @ 2010-05-12 11:01
VRS
阅读(226)
评论(0)
推荐(0)
摘要:
//////////////////////////////////////////////////////////////////////带权的最长公共子串//dp经典例题#include<iostream>#include<string>using namespace std;char x[5000],y[5000];char ch[256];int a[256];vo... 阅读全文
posted @ 2010-05-12 11:00
VRS
阅读(181)
评论(0)
推荐(0)
摘要:
/////////////////////////////////////////#include<iostream>using namespace std;int main(){ int n; while(cin>>n) { int i,count=0; int *a=new int[n+1]; for(i=0;i<n;i++) cin>>a[i]... 阅读全文
posted @ 2010-05-12 10:59
VRS
阅读(118)
评论(0)
推荐(0)
摘要:
////////////////////////////////////////////////////////////////////鸽巢原理做#include<iostream>using namespace std;int buc[10001],peo[20001];int main(){ int i,n,m,count; while(cin>>n>>m ... 阅读全文
posted @ 2010-05-12 10:58
VRS
阅读(157)
评论(0)
推荐(0)
摘要:
#include<iostream>using namespace std;int main(){ int n,u,d; int min,dis; while(cin>>n>>u>>d && !(n==0&&u==0&&d==0)) {/* min=n*2/(u-d); if(min*(u-d)/2+2... 阅读全文
posted @ 2010-05-12 10:57
VRS
阅读(183)
评论(0)
推荐(0)
摘要:
#include<iostream>using namespace std;int main(){ int out,n,x,y; cin>>n; while(n--) { cin>>x>>y; if(x==y||x-y==2) { if(x%2==0) out=x+y; else out=x+y-1; cout<<out<&l... 阅读全文
posted @ 2010-05-12 10:55
VRS
阅读(116)
评论(0)
推荐(0)
摘要:
//////////////////////////////////////////////////////////2^x mod n = 1//给出n,算出最小的x满足2^x mod n = 1//思路:高精度,需要不断地缩小数据的规模。首先,n=1和n=2的倍数时不存在x,// 其次,每次把2^k nod n的余数乘2,得到是原(2^k)*2的余数,即2^(k+1)// 的余数。#includ... 阅读全文
posted @ 2010-05-12 10:55
VRS
阅读(207)
评论(0)
推荐(0)
摘要:
//////////////////////////////////////////////////////////////最小花费路//用最小生成树Prim算法#include<iostream>using namespace std;#define MAX 1000int c[28][28];//先让输入转化为邻接矩阵储存void input(int n){ int i,j,num... 阅读全文
posted @ 2010-05-12 10:54
VRS
阅读(336)
评论(0)
推荐(0)
摘要:
#include<iostream>#include<string>using namespace std;char shu[100],cun[50],zou[50];int main(){ int i,j,num,len,jishu1,jishu2,duwei,yiyou,yizou,zouren; while(cin>>num && num)... 阅读全文
posted @ 2010-05-12 10:53
VRS
阅读(267)
评论(0)
推荐(0)