摘要: #include#include #include#includeusing namespace std;char s1[5005],s2[5005];int dp[2][5005],n;void lcs(){ int i,j; memset(dp,0,sizeof(dp)); f... 阅读全文
posted @ 2015-10-13 21:31 澧浦 阅读(111) 评论(0) 推荐(0)
摘要: 用数组存好数据并按位进行加法运算题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1002#include#include#include#include#include#include#includeusing namespace std;int mai... 阅读全文
posted @ 2015-08-31 23:16 澧浦 阅读(119) 评论(0) 推荐(0)
摘要: 高精度大数运算其实就是由于数字过大必须要用数组来存数据题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1020#include#include#include#include#include#includeusing namespace std;int ... 阅读全文
posted @ 2015-08-31 23:11 澧浦 阅读(121) 评论(0) 推荐(0)
摘要: 大水题,注意看清题意,相同字母在一块#include#include#include#include#include#include#includeusing namespace std;int main(){ int num; char s[10005]; cin>>num; while(num-... 阅读全文
posted @ 2015-08-31 23:07 澧浦 阅读(266) 评论(0) 推荐(0)
摘要: 1 #include 2 #include 3 using namespace std; 4 5 int f[1005]; 6 int x[1005],y[1005]; 7 bool v[1005]; 8 int n,p,k1,k2,r,r1; 9 10 int find(int i)11 {1... 阅读全文
posted @ 2015-08-14 15:41 澧浦 阅读(145) 评论(0) 推荐(0)
摘要: 题目大意,宴会上每个人都想跟自己认识的人坐一块,现在告诉你哪两个人互相认识,假设1认识2,2认识3则有1认识3,1,2,3可以坐一块,即找到连通分支数即可 1 #include 2 int f[10005],n,m; 3 4 //初始化 5 void init() 6 { 7 for(i... 阅读全文
posted @ 2015-08-14 11:04 澧浦 阅读(230) 评论(0) 推荐(0)
摘要: 连通分支数减一就是还要修的路1 #include 2 int f[10005],n,m; 3 4 //初始化 5 void init() 6 { 7 for(int i=1;i<=n;i++) 8 f[i]=i; 9 } 10 //递归函数,不停的去找爹,直到找到祖宗为... 阅读全文
posted @ 2015-08-14 10:48 澧浦 阅读(104) 评论(0) 推荐(0)
摘要: #include#includeusingnamespacestd;boolJudge(intnum1,intnum2,intk){if(k==0)returnfalse;for(inti=1;i<=k;i++){if((num1%10)!=(num2%10))returnfalse;num1/=1... 阅读全文
posted @ 2015-08-11 20:00 澧浦 阅读(149) 评论(0) 推荐(0)
摘要: #include#include#include#include#include#includeusingnamespacestd;intmain(){ intn,s[1005]; intu,flag,min; while(cin>>n) { min=u=0; memset(s,... 阅读全文
posted @ 2015-08-09 13:41 澧浦 阅读(161) 评论(0) 推荐(0)
摘要: 最短路用spfa写的#include#include#include#include#definemax100000500usingnamespacestd;longlongintt,n,m,a,b,c,d1[1000500],d2[1000500],flag[1000500],head2[1000... 阅读全文
posted @ 2015-08-06 17:32 澧浦 阅读(102) 评论(0) 推荐(0)