自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(18)
  • 收藏
  • 关注

原创 高精度

#include#includechar a[320],b[320],sum[320];int flag=0;#define N 320void add(char a[320],char b[320],char back[320]){ int i,j,k,up,x,y,z,l; // char *c;// printf("aaaa"); if

2009-09-11 19:15:00 402

原创 图的建立-深度DFS-广度BFS

#include#includeusing namespace std;struct MGraph{char vertex[10];int arc[10][10];int vertexNum,arcNum;};int visited[100]={0};void creatMGraph(MGraph &g){int i,j,k;coutcin>>g.vertexNum>>g.arcNum;coutc

2009-08-09 23:35:00 501

原创 Bignum Arithmetic--------大数相乘的实例

Bignum ArithmeticTime Limit:1sMemory limit:32MAccepted Submit:237Total Submit:585In this problem, you will be concerned with integers with very large numbers of d

2009-08-09 23:34:00 615

原创 Andy的作业--大数乘小数

Andy的作业Time Limit:1sMemory limit:32MAccepted Submit:232Total Submit:1674Andy每天都有很多作业要做,他的老师总是在说“这些作业你明天必须交上来……”。现在他找你帮忙做其中的一项作业,给出N个整数A1, A2, ..., AN,有 M 个询问 q (L

2009-08-09 23:33:00 446

原创 HDU1002 A + B Problem II--大数相加的应用

题目连接请点击:http://acm.hdu.edu.cn/showproblem.php?pid=1002解题分析:1.大数相加,用数组存储数据,先定义字符数组,后转化为整型数组,还有数组的第一位即比如int a[1000];则a[0]为这个数组的长度02.需注意输出格式:最后一个测试数据不能有回车换行哦!code:#include#includechar a[1000]

2009-08-09 23:29:00 419

原创 QS Network--prim算法的应用

QS NetworkTime Limit:1sMemory limit:32MAccepted Submit:232Total Submit:750In the planet w-503 of galaxy cgb, there is a kind of intelligent creature named QS. QSc

2009-08-06 23:57:00 429

原创 ZOJ Problem Set - 2029The Intervals—二分查找实例

The IntervalsTime Limit: 1 Second      Memory Limit: 32768 KBCantor, the famous mathematician, was working on a problem about intervals.Lets start from a line segment of unit length. Remove i

2009-08-06 23:53:00 439

原创 queue队列容器-priority_queue优先队列

关于队列的知识;使用queue之前,要先利用构造函数一个队列对象,才可以进行元素的入队,出队,取队首和队尾等操作;(1).queue() queue q; 或者 queueQ[10000]; (2).queue(const queue&) 复制构造函数 例如:用一行代码利用queue对象q1,创建一个以双向链表为底层容器的queue对象q2queue>q1;queue>q2

2009-08-05 22:36:00 552

原创 二叉树全解

二叉树的构造,前序遍历,中序遍历,后序遍历,求树高,叶子节点树分析#includeusing namespace std;int num=0;struct BiNode{ char data; BiNode *lchild,*rchild;};void Creat(BiNode* &root){char ch;//coutcin>>ch;if(ch==#) root=NULL;    

2009-08-04 23:34:00 410

原创 最大公约数和最小公倍数

辗转相除法求最大公约数。原数除以最大公约数就是最小公倍数了!code: #includeint gcd(int a,int b){ if(b!=0)  return gcd(b,a%b); else  return a;}int gcd2(int a,int b){     int r;          while(b!=0)    { r=a%b;            a=b;   

2009-08-04 23:33:00 577

原创 经典算法求大范围内素数

     经典算法求素数问题解析:利用一个范围大数组a【100000000】,x不是素数,则a【x】=2;如果x是素数那么a【x】=1;a[2]=1;                                //初始化for (i=3;i1000000;i++)               //初始化  {   a[i++]=1;   a[i]=2;  }   for (i=

2009-08-04 23:32:00 795

原创 prim经典算法求最小生成树

Prim算法  Prim算法用于求无向图的最小生成树  设图G =(V,E),其生成树的顶点集合为U。  ①、把v0放入U。  ②、在所有u∈U,v∈V-U的边(u,v)∈E中找一条最小权值的边,加入生成树。  ③、把②找到的边的v加入U集合。如果U集合已有n个元素,则结束,否则继续执行②。  其算法的时间复杂度为O(n^2)  Prim算

2009-08-04 23:30:00 816

原创 字符串模式匹配KMP算法

  next【100】的值去改变每次匹配的位置注意:字符串的保存最好用字符数组,然后用字符输入的形式,保证正确!利用求模式串的next[]值来分析遍历,可以在不改变主串i的值的基础上,只改变next[j]的下标来遍历;next[j]={   0    当j=1   Max{k|1     1    { 没有部分匹配}};#include#includeusing n

2009-08-04 23:28:00 404

原创 二分查找

二分查找技术作为一种查找技术。与顺序查找,效率高很多!#include#define MAXL 100typedef struct{ int key;}NodeType; typedef NodeType SeqList[MAXL]; /********二分查找************/ int BinSearch(SeqList &R,int n,int k)        {    

2009-08-03 23:45:00 401

原创 二叉树全解

二叉树的构造,前序遍历,中序遍历,后序遍历,求树高,叶子节点树分析#includeusing namespace std;int num=0;struct BiNode{ char data; BiNode *lchild,*rchild;};void Creat(BiNode* &root){char ch;//coutcin>>ch;if(ch==#) root=NULL;    

2009-08-02 23:34:00 596

原创 Commandos--关于foyld经典算法

CommandosA group of commandos were assigned a critical task. They are to destroy an enemy head quarter. The enemy head quarter consists of several buildings and the buildings are connected by

2009-08-01 22:53:00 720

原创 FZUOJ1656-How many different numbers解题技巧

分析一:利用容器map不能存放一样的数值的特性,此方法用在数据相对小的时候比较好但是对于数据比较大的时候就会超时TLE,超时的原因我想应该是:当输入m和n的值过大的时候,map的插入操作就会超时;#include#includeusing namespace std;int main(){ register int i,j,x; long N; int K; long m,n; int a[1

2009-07-30 23:04:00 425

原创 汉诺塔和四塔分析

   汉诺塔与四塔问题A:经典汉诺塔题目描述:有N个圆盘和三座塔X,Y,Z,要将X上的所有圆盘移动到Y借助Z;要求一次移动一个,且小的圆盘不能在大的下面;运用递归的方法可解决:读者做这一题之前,最好先去看一下递归算法哦;程序代码如下:#includeenum tower {A=X,B=Y,C=Z};long k=0;                         

2009-07-29 23:29:00 1431

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除