#include
#include
#define LENGTH 100 //初始分配栈的长度
#define ADD_LEN 10 //栈长增量
typedef struct //定义字符栈
{ int *base;
int *top;
int stacksize;
}SqStack;
void InitStack(SqStack &S); //初始化一...
分类:
其他好文 时间:
2014-08-01 13:50:31
阅读次数:
237
#include
#include
typedef struct
{ char *ch;
int length;
}HString;
void StrAssign(HString &T,char *chars);
void StrLength(HString S);
void StrCompare(HString S,HString T);
void ClearString(HString &S...
分类:
其他好文 时间:
2014-08-01 13:50:01
阅读次数:
123
#include
#include
#define LENGTH 100 //初始分配栈的长度
#define ADD_LEN 10 //栈长增量
typedef struct
{//构造栈的数据类型
int *base;
int *top;
int stacksize;
}SqStack;
void CreateStack(SqStack &S);//初始化一个栈
void PushS...
分类:
其他好文 时间:
2014-08-01 13:49:41
阅读次数:
187
Cow UncleTime Limit:4000/2000MS (Java/Others)Memory Limit:128000/64000KB (Java/Others)SubmitStatusProblem DescriptionSouth China Algorithm University ...
分类:
其他好文 时间:
2014-08-01 13:27:41
阅读次数:
274
尾递归和一般的递归不同在对内存的占用,普通递归创建stack累积而后计算收缩,尾递归只会占用恒量的内存(和迭代一样)。SICP中描述了一个内存占用曲线,用以上答案中的Python代码为例(普通递归):def recsum(x): if x == 1: return x else: r...
分类:
其他好文 时间:
2014-08-01 12:47:31
阅读次数:
353
Suppose n
#include
#include
#include
using namespace std;
bitset getComb(const vector &comb) {
bitset bitcombs;
for (int i=0; i<comb.size(); ++i) bitcombs.set(comb[i], true);
return bitcombs...
分类:
其他好文 时间:
2014-08-01 09:19:21
阅读次数:
267
Single NumberGiven an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runti...
分类:
其他好文 时间:
2014-08-01 04:44:31
阅读次数:
189
分拆素数和
Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u
Submit
Status
Practice
HDU 2098
Description
把一个偶数拆成两个不同素数的和,有几种拆法呢?
Input
输入包含一些正的偶数,其值不会超过10000,个数不...
分类:
其他好文 时间:
2014-07-31 23:55:50
阅读次数:
279
一、基本概念 带余除法(division algorithm,除法定理):a∈Z,d∈Z*,有唯一的整数 q 和 r,并且0≤r<d0,满足 a= d q+r。q 称为商,r 称为余数。通俗说法:整数除以正整数得到唯一的商(quotient)和余数(re...
分类:
其他好文 时间:
2014-07-31 23:12:30
阅读次数:
297
贪心,排序从大到小。。
先比大的,跑不过就拿最小的来送死。。,
如果是平局就比后面的。。。
若后面也是平局就拿去跟前面的去跑。。。
#include
#include
#include
#include
using namespace std;
int s[1005],w[1005];
int main()
{
int n,i;
while(scanf("...
分类:
其他好文 时间:
2014-07-31 20:50:47
阅读次数:
153