摘要: /*题目1)简介输入:正则表达式字符串 待匹配字符串,如果输入”### ###”程序终止,输出:如匹配成功,输出整个字符串,如果匹配不成功,输出lost,然后等待下一次用户的输入。^ 代表字符串开始. 代表任意字符$ 代表字符串末尾2)参考输入,输出^a.$ abc ←regular express and target string (separate by space),inputlost ←result, outputab.$ ababc ←regular express and target string (separate by space), inputababc ←match s 阅读全文
posted @ 2012-02-29 22:41 yejinru 阅读(5892) 评论(0) 推荐(1) 编辑
摘要: 编辑器加载中...本电子词典功能:查单词,单词复习,单词学习,单词填空,根据汉语输入英文,有时间提示的单词风暴第一部分:main函数编写#include <stdio.h>#include <string.h>#include "list.h"#include "tool.h"#include "game.h"#include <stdlib.h>int main(){int m=0,n=7950,c;char ch[130];struct wordnode *head=NULL;head=Crea 阅读全文
posted @ 2012-02-29 22:40 yejinru 阅读(674) 评论(0) 推荐(1) 编辑
摘要: ZOJ自己做了的(简单题,可直接点击题号到该题网页):1001 1002 1037 1045 1048 1049 1057 1067 1073 1078 1086 1089 1090 1095 1109 1110 1115 1151 1195 1240 1241 1251 1295 1414 1631 1715 1730 1755 1760 1763 1796 1884 1915 2001 2022 2060 2095 2099 2104 2108 2172 2176 2186 2201 2321 2345 2388 2405 2417 2421 2433 2476 2478 2480 248 阅读全文
posted @ 2012-02-29 22:40 yejinru 阅读(1062) 评论(0) 推荐(1) 编辑
摘要: #include <stdio.h>#include <stdlib.h>#define MAXN 1000 typedef struct queue{int qq[MAXN]; //队中元素int front; //队首下标int rear; //队尾下标int count; //队列中元素个数}queue;queue *q;int init() //队列初始化{q=(struct queue*)malloc(sizeof(struct queue)); //申请内存q->front=0; //都置为0q->rear=0;q->count=0;ret 阅读全文
posted @ 2012-02-29 22:38 yejinru 阅读(289) 评论(0) 推荐(0) 编辑
摘要: #include <cstdlib>#include <iostream>#include <cstdio> using namespace std;#define X 150001typedef struct node{ int id,m; int key; //按顺序}node;struct node f[X];int cmp(const void *a,const void *b){ struct node *c=(node *)a; //强转 struct node *d=(node *)b; if(d->m==c->m) //如果相等, 阅读全文
posted @ 2012-02-29 22:37 yejinru 阅读(169) 评论(0) 推荐(0) 编辑
摘要: //贪心法,使用排序函数,每次都找最便宜的牛奶,然后判断够没够重量#include <iostream>#include <algorithm>#define X 5010using namespace std;typedef struct milk //定义牛奶结构体{ int p; int a;}milk;int cmp(milk a,milk b) //对牛奶结构体排序{ return a.p<b.p; }int main(){ int n,m; freopen("sum.in","r",stdin); freopen 阅读全文
posted @ 2012-02-29 22:37 yejinru 阅读(282) 评论(0) 推荐(0) 编辑
摘要: 1000 A+B Problem 10% 直接加1002 Phone Numbers 50% 动态规划或最短路1003 Parity 70% 区间减法1004 Sightseeing trip 60% 最短路1005 Stone Pile 30% 动态规划或搜索1006 Square Frames 35% 模拟1007 Code Words 30% 模拟1008 Image encoding 30% 广度优先搜索1009 K-Based Numbers 20% 递推或枚举(数据规模小) 1010 Discrete Function 40% 贪心1011 Conductors 25% 搜索101 阅读全文
posted @ 2012-02-29 22:36 yejinru 阅读(300) 评论(0) 推荐(1) 编辑
摘要: Find a minimal interger K which is merely comprised of N and can be divided by M.For example,11 is the minimal number that and be divided by 11, and it is comprised of two '1's, and 111111 can be divided by 13 which is comprised of six '1's.InputOn each line of input , there will be 阅读全文
posted @ 2012-02-29 22:35 yejinru 阅读(371) 评论(0) 推荐(0) 编辑
摘要: 编辑器加载中...自己写了一个:根据m^n mod y,m*m*...*m = y*x+r,再乘以m时相当于r乘以m即可同理,令r = 1,r = (r*m)%y,这样相乘n次,我的模板(时间复杂度为O(n)),n太大时,可能超时:int r = 1;for(j=0;j<n;j++)r = (r*i)%m;求a^b%c(这就是著名的RSA公钥的加密方法) 算法1:直接将b个a相乘,利用a*b%c=((a%c)*b)%c,每一步都进行这种处理,解决了a^b可能太大存不下的问题,这个算法的时间复杂度是O(n)。当b很大时运行时间会很长 。 算法2:利用分治的思想,可以达到O(logn)。 可 阅读全文
posted @ 2012-02-29 22:34 yejinru 阅读(192) 评论(0) 推荐(0) 编辑
摘要: 偶做完的:1000100110021003100410051006100710081011101210141017102810391041104610471050106110641066106710681080108810891094110111021106111311181125112611271129114011411144114511491151115911631164118211901195120112041207122212261228123612371247125112581265126912701273127412761284128613081325132813301338135 阅读全文
posted @ 2012-02-29 22:32 yejinru 阅读(539) 评论(0) 推荐(1) 编辑