摘要:#include #include #include #include #include #include #include #include #include #include #define NSY "Not sure yet.\n" #define IDG "In different gangs.\n" #define ITSG "In the same gang.\n...
阅读全文
摘要:#include #include #include using namespace std; typedef struct node{//邻接表上的节点 int n; struct node * next; } GNode; typedef struct graph{//图的整个结构 int cn;//顶点个数 int bn;//边的个数 G...
阅读全文
摘要:设计函数分别求两个一元多项式的乘积与和。 输入格式: 输入分2行,每行分别先给出多项式非零项的个数,再以指数递降方式输入一个多项式非零项系数和指数(绝对值均为不超过1000的整数)。数字间以空格分隔。 输出格式: 输出分2行,分别以指数递降方式输出乘积多项式以及和多项式非零项的系数和指数。数字间以空
阅读全文
摘要:/* 使用一个数组实现两个堆栈,要求最大的利用数组空间,使数组只要有空间入栈操作就可以 成功 分析:一种比较聪明的方法是使这两个栈分别从数组 两头开始向中间生长,当两个栈的栈顶指针相遇,表示栈满 */ #include #include using namespace std; const int MaxSize = 1e3; struct Dstack{ int Data[Max...
阅读全文
摘要:Given a sequence of KKK integers { N1N_1N1, N2N_2N2, ..., NKN_KNK }. A continuous subsequence is defined to be { NiN_iNi, Ni+1N_{i+1}Ni+1
阅读全文