上一页 1 2 3 4 5 6 7 8 ··· 12 下一页

2012年8月14日

hdu(1874)最短路径问题

摘要: 贡献了一次wa,有重边,忘了考虑,看下discuss真好,要不然不知道这错误要找到什么时候这道题算是基础题吧 1 #include <cstring> 2 #include <stdio.h> 3 #define Max 0x7f7f7f7f 4 using namespace std; 5 int map[205][205]; 6 int dis[205],visited[205]; 7 int n,start,end; 8 void Dijkstra() 9 {10 dis[start]=0;11 int pos;12 for(int i=0;i<n;i++) 阅读全文

posted @ 2012-08-14 10:39 矮人狙击手! 阅读(253) 评论(0) 推荐(0) 编辑

CodeBlocks中文版使用手册

摘要: 原手册下载:http://www.codeblocks.org/docs/manual_en.pdf 译者:JGood(http://blog.csdn.net/Jgood) 译者言:工欲善其事,必先利其器。一个好的工具能事半功倍。写程序时,特别是写C++程序,大部分人脑子里想到的第一个工具就是VisualStudio。不可否认,VS很好很强大,用户体验非常好。但VisualStudio也是有缺点的:它非常庞大;只支持VC,不支持其他的编译器;VS只能在windows下跑,在其他os上就无用武之地;VS是要钱的,而且费用不非(Express版本免费)。Code::Blocks是一个非常优秀的工 阅读全文

posted @ 2012-08-14 10:01 矮人狙击手! 阅读(11349) 评论(0) 推荐(0) 编辑

hdu(2112)最短路径问题

摘要: 两个小小的细节,调试了半天啊,不过这次学了下在codeblocks里面的调试,原来我只会在vc里面调试阻断路径问题,Dijkstra算法,从起始点到终点,只要两个步骤,第一求距离起始点最短的点,把该点加入起点集后更新起点到其余个点的距离,知道把所有点都添加进来,所以外循环的次数就是点数 1 #include <stdio.h> 2 #include <cstring> 3 #include <stdlib.h> 4 #define MAX 0x7f7f7f7f 5 int map[155][155],visited[155],dis[155]; 6 char 阅读全文

posted @ 2012-08-14 09:59 矮人狙击手! 阅读(320) 评论(0) 推荐(0) 编辑

2012年8月13日

hdu1709

摘要: 简单题吧,只要把多项式相乘的原理搞明白了,应该很容易想到思路,可能表达上还略微有点不太顺畅 1 #include <iostream> 2 #include <cstring> 3 using namespace std; 4 int res[255][105];//第一个中括号表示金额,第二个中括号表示硬笔数量,值表示有多少种方法 5 int tmp[255][105]; 6 int main () 7 { 8 memset(res,0,sizeof(res)); 9 memset(tmp,0,sizeof(tmp));10 int value[]={0,1,5,10 阅读全文

posted @ 2012-08-13 21:53 矮人狙击手! 阅读(182) 评论(0) 推荐(0) 编辑

hdu2609

摘要: 这一道题有一个需要考虑的东东,就是硬币的数量不可以超过100,如果没有这个条件的话,还真的是水题一枚所以这道题要用到二维数组,其中有一个来存硬币的 1 #include <iostream> 2 #include <cstring> 3 using namespace std; 4 int res[255][105];//第一个中括号表示金额,第二个中括号表示硬笔数量,值表示有多少种方法 5 int tmp[255][105]; 6 int main () 7 { 8 memset(res,0,sizeof(res)); 9 memset(tmp,0,sizeof(tm 阅读全文

posted @ 2012-08-13 21:51 矮人狙击手! 阅读(231) 评论(0) 推荐(0) 编辑

母函数的分析与总结

摘要: 转自:关于什么是母函数 , 以及在现实生活中的应用 , 请大家详看 或者 HDU 母函数 PPT:http://www.cppblog.com/MiYu/archive/2010/08/05/122290.html对于给出的母函数模板 , 让人理解起来比较费劲的!以下给出几种解释 , 和自己理解!//made by syx //time 2010年9月11日 10:17:27//母函数例题/*//整数拆分模板#include <iostream>using namespace std;const int lmax=10000;//c1是用来存放展开式的系数的,而c2则是用来计算时保 阅读全文

posted @ 2012-08-13 09:04 矮人狙击手! 阅读(216) 评论(0) 推荐(0) 编辑

2012年8月12日

hdu1028(母函数)

摘要: 母函数原来学过一点,不过现在差不多是忘完了,再次学习,刚开始仍感觉不是那么好理解 1 #include <stdio.h> 2 using namespace std; 3 int main() 4 { 5 int n; 6 int a[121],b[121]; 7 int i,j,k; 8 while(1) 9 {10 scanf("%d",&n);11 for(i=0;i<=n;i++){a[i]=1;b[i]=0;}12 for(i=2;i<=n;i++)//第几个多项式13 {14 ... 阅读全文

posted @ 2012-08-12 21:21 矮人狙击手! 阅读(186) 评论(0) 推荐(0) 编辑

hdu1863(最小生成树,并查集)

摘要: 这道题比较有意思,除了用并查集外,还可以用prim,k……(不记得怎么写了)来写 1 #include<iostream> 2 #include<stdio.h> 3 #include<string.h> 4 #include<algorithm> 5 using namespace std; 6 7 int father[101]; 8 bool flags[101]; 9 10 struct country11 {12 int first;13 int second;14 int value;15 }a[5001];16 17 bool cm 阅读全文

posted @ 2012-08-12 16:49 矮人狙击手! 阅读(221) 评论(0) 推荐(0) 编辑

hdu1232(跟前面某一题一样的啊)

摘要: 1 #include <stdio.h> 2 3 using namespace std; 4 5 int set[1005]; 6 int sum; 7 void makeset(int n) 8 { 9 for(int i=1;i<=n;i++)10 {11 set[i]=i;12 }13 }14 15 16 int findset(int x)//查17 {18 if(x!=set[x])19 {20 set[x]=findset(set[x]);//之所以不可以直接返回是因为这里可能有多... 阅读全文

posted @ 2012-08-12 16:30 矮人狙击手! 阅读(134) 评论(0) 推荐(0) 编辑

hdu1856(并查集)

摘要: 1 #include <stdio.h> 2 #include <algorithm> 3 using namespace std; 4 int set[10000005]; 5 int num[10000005]; 6 7 int cmp(int a,int b) 8 { 9 return a>b;10 }11 12 void makeset()13 {14 for(int i=1;i<10000005;i++)15 {16 set[i]=i;17 num[i]=1;18 }19 }20 21 22 int ... 阅读全文

posted @ 2012-08-12 16:15 矮人狙击手! 阅读(171) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 8 ··· 12 下一页

导航