上一页 1 ··· 5 6 7 8 9 10 11 下一页
摘要: http://poj.org/problem?id=1838并查集,,,计算总共个数的模版。。。。。 1 #include 2 #define maxn 16006 3 #include 4 using namespace std; 5 6 struct node{ 7 int x,y; 8 int index; 9 }q[maxn];10 11 int f[maxn],rank[maxn],sum[maxn];12 13 void init(int n){14 for(int i=0;iy;33 }34 35 int find(int x){36 if(x... 阅读全文
posted @ 2013-08-01 19:32 夜晓楼 阅读(152) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1850 -----------------http://poj.org/problem?id=1496 两题解法类似。。本题为组合数学的题,要求所给字符串在排列中的位置。所用的方法为暴力枚举。 对于长度为1的字符串有a,b,c,d.......26个;长度为2的字符串有 a开头时有ab,ac,ad,ae,af.....(25,1) 25个 //()为组合数 b开头时有bc,bd,de,.....(24,1) 24个 c开头时有cd,ce,cf。。。(23,1) 23个 。。... 阅读全文
posted @ 2013-07-17 17:41 夜晓楼 阅读(233) 评论(0) 推荐(0) 编辑
摘要: 一道字符串的题。。不过。。挺麻烦的。。。 1 #include 2 #include 3 using namespace std; 4 char dic[10005][20]; 5 char word[55][20]; 6 int diclen[10005];//字典中每个单词的长度 7 8 bool change(char *a, char *b){ 9 int dif = 0; 10 while(*a){ 11 if(*(a++)!=*(b++)){ 12 dif++;//记录不相同的字符的个数,如果大于1就不合... 阅读全文
posted @ 2013-07-17 12:21 夜晓楼 阅读(210) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=3252//自己搞了很长时间。。。现在刚刚有点明白。。 1 #include 2 3 using namespace std; 4 long long c[35][35]; 5 void init(){ 6 for(int i=0;ib)14 return a;15 return b;16 }17 long long solve(long long n){18 int len=0;19 int bit[35];20 while(n){//得到二进制数1--len21 ... 阅读全文
posted @ 2013-07-16 18:51 夜晓楼 阅读(186) 评论(0) 推荐(0) 编辑
摘要: 比较坑的一道题。。。直接做肯定WAhttp://acm.hdu.edu.cn/showproblem.php?pid=1013 1 #include 2 #include 3 using namespace std; 4 int main(){ 5 char a[1000]; 6 while(cin>>a){ 7 int len = strlen(a); 8 long long n =0; 9 for(int i=0;i9)//这个地方设置得比较巧妙,直接判断是不是小于9即可。。。。。。我当初使用。。。。下边附。。。21 ... 阅读全文
posted @ 2013-07-16 08:34 夜晓楼 阅读(189) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2965本题要结合poj 1753 来看最好。。。又有了一点搜索的经验。。加油。。。 1 #include 2 #include 3 #include 4 using namespace std; 5 int step[655350]; 6 bool flag[655350]; 7 unsigned qState[655350]; 8 struct node{ 9 int from,index;10 } f[655350];//用于存它在队列中的生成他的那个节点的位置,和生成他的那个节点的在位置数组中的位置即--i---也就是ind... 阅读全文
posted @ 2013-07-15 16:55 夜晓楼 阅读(248) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=1844首先 必须满足如果全是正数的话 sum 要大于s;如果sum 2 3 using namespace std; 4 5 int main() 6 { 7 int s; 8 while(cin>>s){ 9 int i =1;10 int sum = 0;11 while(sum<s){12 sum += i;13 i++;14 }15 while((sum-s)%2==1){16 ... 阅读全文
posted @ 2013-07-15 10:15 夜晓楼 阅读(184) 评论(0) 推荐(0) 编辑
摘要: http://poj.org/problem?id=2309//找规律 可以看到每个根节点都可以将其在同一层的最左边的根节点整除,并且最大值为该节点加上最左边的节点值-1,最小值为////为该节点减去最左边的节点值-11 #include 2 #include 3 using namespace std; 4 5 int main() 6 { 7 long long s[35]; 8 s[0] =1; 9 for(int i=1;i>t;13 while(t--){14 cin>>n;15 if(n%2){16 cout=0;j... 阅读全文
posted @ 2013-07-15 09:27 夜晓楼 阅读(220) 评论(0) 推荐(0) 编辑
摘要: 请没命的看Java。。php。。算法。。。争取最有一个周有一个超越。。加油、。。。。 阅读全文
posted @ 2013-07-10 08:32 夜晓楼 阅读(153) 评论(0) 推荐(0) 编辑
摘要: 不知不觉实训已经过去第二周了,这周队长看了我的代码,说太乱了,就去自己改了。。我也不知道结果究竟怎么样,,,这一周一直跟带队的师姐以及宿舍的师哥聊天,知道了很多东西:1、现在我们最应该做的就是提高自己的能力,荣誉什么的应该看淡,,其实也是,这些实在是没意思,自己实力不强,有一些水的名誉有什么用,想到这突然想起来了高三时我去找davy聊天,说自己的名次一直不能提高,davy当时就是这么跟我说的,要看到自己的提高,这才是最重要的。其实自己什么水平,在行家眼里一样就能看出来。2、再就是就业的时候,基础必须打捞,还应该有一技之长。。这才是最好的。。如果不打算考研这才是应该考虑的。还有就是自己考研如果还 阅读全文
posted @ 2013-07-08 18:45 夜晓楼 阅读(246) 评论(0) 推荐(0) 编辑
上一页 1 ··· 5 6 7 8 9 10 11 下一页