摘要: 中国剩余定理例1:一个数被3除余1,被4除余2,被5除余4,这个数最小是几?题中3、4、5三个数两两互质。则〔4,5〕=20;〔3,5〕=15;〔3,4〕=12;〔3,4,5〕=60。为了使20被3除余1,用20×2=40;使15被4除余1,用15×3=45;使12被5除余1,用12×3=36。然后,40×1+45×2+36×4=274,因为,274>60,所以,274-60×4=34,就是所求的数。例2:一个数被3除余2,被7除余4,被8除余5,这个数最小是几?题中3、7、8三个数两两互质。则〔7,8〕=56;〔3, 阅读全文
posted @ 2012-02-29 22:41 yejinru 阅读(248) 评论(0) 推荐(0)
摘要: 编辑器加载中...本电子词典功能:查单词,单词复习,单词学习,单词填空,根据汉语输入英文,有时间提示的单词风暴第一部分: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 阅读(695) 评论(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 阅读(1239) 评论(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 阅读(301) 评论(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 阅读(179) 评论(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 阅读(289) 评论(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 阅读(312) 评论(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 阅读(378) 评论(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 阅读(198) 评论(0) 推荐(0)
摘要: 偶做完的:1000100110021003100410051006100710081011101210141017102810391041104610471050106110641066106710681080108810891094110111021106111311181125112611271129114011411144114511491151115911631164118211901195120112041207122212261228123612371247125112581265126912701273127412761284128613081325132813301338135 阅读全文
posted @ 2012-02-29 22:32 yejinru 阅读(563) 评论(0) 推荐(1)