恒邪

上一页 1 ··· 5 6 7 8 9 10 11 12 13 下一页

2014年4月4日 #

超有意思的小学编程题

摘要: 由于小学生所拥有的计算方法有限(他不会用函数,数组,循环,判断等一系列复杂语法结构)Problem E: 武功秘籍Time Limit: 1 SecMemory Limit: 128 MBDescription小明到X山洞探险,捡到一本有破损的武功秘籍(2000多页!当然是伪造的)。 他注意到:书的第10页和第11页在同一张纸上,但第11页和第12页不在同一张纸上 。小明只想练习该书的第a页到第b页的武功,又不想带着整本书。请问他至少要撕下多少张纸带走?Input有多组测试实例,输入小明想要练习的起始页a和末尾页b。(a 2 #include 3 using namespace std; 4. 阅读全文

posted @ 2014-04-04 19:39 恒邪 阅读(1852) 评论(0) 推荐(0) 编辑

2014年4月2日 #

[ACM] hdu 1286 找新朋友(欧拉函数)

摘要: 找新朋友Time Limit: 2000/1000 MS(Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s):6928Accepted Submission(s): 3593Problem Description新年快到了,“猪头帮协会”准备搞一个聚会,已经知道现有会员N人,把会员从1到N编号,其中会长的号码是N号,凡是和会长是老朋友的,那么该会员的号码肯定和N有大于1的公约数,否则都是新朋友,现在会长想知道究竟有几个新朋友?请你编程序帮会长计算出来。Input第一行是测试数据的组数CN(Casenu 阅读全文

posted @ 2014-04-02 20:39 恒邪 阅读(160) 评论(0) 推荐(0) 编辑

环形队中实现队列的基本运算

摘要: /*队空条件:front=rear队满条件:(rear+1)%MaxSize=front进队e操作:rear=(rear+1)%MaxSize; 将e放在rear处出队操作:front=(front+1)%MaxSize;取出front处元素e; */#include #include using namespace std;const int maxn=4;typedef struct{ int data[maxn]; int front,rear;}queue;//初始化队列void init(queue *&q){ q=(queue*)malloc(sizeof(que... 阅读全文

posted @ 2014-04-02 19:17 恒邪 阅读(341) 评论(0) 推荐(0) 编辑

队列的顺序存储结构及其基本运算的实现

摘要: 代码:#include #include using namespace std;const int maxn=500;typedef struct{ int data[maxn]; int front,rear;}queue;//初始化队列void init(queue *&q){ q=(queue*)malloc(sizeof(queue)); q->rear=q->front=-1;}//销毁队列void destroy(queue *&q){ free(q);}//判断队列是否为空bool empty(queue *&q){ return q-> 阅读全文

posted @ 2014-04-02 18:56 恒邪 阅读(293) 评论(0) 推荐(0) 编辑

栈的链式存储结构及其基本运算实现

摘要: #include #include using namespace std;typedef struct linknode{ int data; struct linknode *next;}Listack;//初始化栈void init(Listack *&s){ s=(Listack*)malloc(sizeof(Listack)); s->next=NULL;}//摧毁栈void destroy(Listack *&s){ Listack *p=s,*q=s->next; while(q!=NULL) { free(p); ... 阅读全文

posted @ 2014-04-02 18:21 恒邪 阅读(206) 评论(0) 推荐(0) 编辑

栈的顺序存储结构及其基本运算实现

摘要: #include #include using namespace std;const int maxn=500;typedef struct { int data[maxn]; int top;}Stack;//初始化stackvoid init(Stack *&s){ s=(Stack *)malloc(sizeof(Stack)); s->top=-1;}//销毁stackvoid destroy(Stack *&s){ free(s);}//判断栈是否为空bool empty(Stack *s){ return (s->top==-1);}//进stackv 阅读全文

posted @ 2014-04-02 18:20 恒邪 阅读(186) 评论(0) 推荐(0) 编辑

2014年4月1日 #

[ACM] hdu 1205 吃糖果(鸽巢原理)

摘要: 吃糖果Time Limit: 6000/3000 MS (Java/Others)Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 21695Accepted Submission(s): 6185Problem DescriptionHOHO,终于从Speakless手上赢走了所有的糖果,是Gardon吃糖果时有个特殊的癖好,就是不喜欢将一样的糖果放在一起吃,喜欢先吃一种,下一次吃另一种,这样;可是Gardon不知道是否存在一种吃糖果的顺序使得他能把所有糖果都吃完?请你写个程序帮忙计算一下。Input第一行有一个整数T 阅读全文

posted @ 2014-04-01 11:05 恒邪 阅读(260) 评论(0) 推荐(0) 编辑

[ACM] poj 3128 Leonardo's Notebook (置换群,循环节)

摘要: Leonardo's NotebookTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 1791Accepted: 787Description— I just bought Leonardo's secret notebook! Rare object collector Stan Ucker was really agitated but his friend, special investigator Sarah Kepticwas unimpressed.— How do you know it is ge 阅读全文

posted @ 2014-04-01 10:43 恒邪 阅读(205) 评论(0) 推荐(0) 编辑

2014年3月31日 #

hdu acm 1051 Zipper

摘要: dfs 有点麻烦,不过也不是很难 1 #include 2 #include 3 #include 4 char str1[205],str2[205],str3[405]; 5 int flag; 6 int len1,len2,len3; 7 int hash[205][205]; 8 void dfs(int a,int b,int c) 9 {10 if(flag)11 return;12 if(c==len3)13 {14 flag=1;15 return;16 }17 if(hash[a][b])18 ... 阅读全文

posted @ 2014-03-31 20:48 恒邪 阅读(205) 评论(0) 推荐(0) 编辑

[ACM] poj 2369 Permutations (置换群循环节长度)

摘要: DescriptionWe remind that the permutation of some final set is a one-to-one mapping of the set onto itself. Less formally, that is a way to reorder elements of the set. For example, one can define a permutation of the set {1,2,3,4,5} as follows: This record defines a permutation P as follows: P(1) = 阅读全文

posted @ 2014-03-31 20:05 恒邪 阅读(439) 评论(0) 推荐(0) 编辑

上一页 1 ··· 5 6 7 8 9 10 11 12 13 下一页

导航