随笔分类 -  数据结构 ---- hash

HDU 1395 2^x mod n = 1
摘要:2^x mod n = 1Time Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 6543Accepted Submission(s): 1961Problem DescriptionGive a number n, find the minimum x(x>0) that satisfies 2^x mod n = 1.InputOne positive integer on each line, the value of n.OutputIf 阅读全文

posted @ 2012-07-13 21:49 江财小子 阅读(263) 评论(0) 推荐(0)

POJ 3320 Jessica's Reading Problem
摘要:Jessica's Reading ProblemTime Limit: 1000MSMemory Limit: 65536KTotal Submissions: 5592Accepted: 1646DescriptionJessica's a very lovely girl wooed by lots of boys. Recently she has a problem. The final exam is coming, yet she has spent little time on it. If she wants to pass it, she has to ma 阅读全文

posted @ 2012-07-13 20:08 江财小子 阅读(271) 评论(0) 推荐(0)

POJ 1840 Eqs
摘要:EqsTime Limit: 5000MSMemory Limit: 65536KTotal Submissions: 8484Accepted: 4187DescriptionConsider equations having the following form: a1x13+ a2x23+ a3x33+ a4x43+ a5x53=0The coefficients are given integers from the interval [-50,50].It is consider a solution a system (x1, x2, x3, x4, x5) that verifi 阅读全文

posted @ 2012-07-13 18:42 江财小子 阅读(148) 评论(0) 推荐(0)

HDU 2522 A simple problem
摘要:A simple problemTime Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 1946Accepted Submission(s): 665Problem DescriptionZty很痴迷数学问题.。一天,yifenfei出了个数学题想难倒他,让他回答1 / n。但Zty却回答不了^_^. 请大家编程帮助他.Input第一行整数T,表示测试组数。后面T行,每行一个整数 n (1#include int hash[100000];int m. 阅读全文

posted @ 2012-07-13 14:46 江财小子 阅读(219) 评论(0) 推荐(0)

HDU 1496 Equations
摘要:EquationsTime Limit: 6000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2879Accepted Submission(s): 1114Problem DescriptionConsider equations having the following form: a*x1^2+b*x2^2+c*x3^2+d*x4^2=0a, b, c, d are integers from the interval [-50,50] and any of the 阅读全文

posted @ 2012-07-13 14:37 江财小子 阅读(160) 评论(0) 推荐(0)

HDU 1425 sort
摘要:给你n个整数,请按从大到小的顺序输出其中前m大的数。Input每组测试数据有两行,第一行有两个数n,m(0//比用快排做快了200Ms#include #include inta[1000001];intmain(){ //freopen("in.txt","r",stdin); intn,m,k; while(scanf("%d%d",&n,&m)!=EOF) { memset(a,0,sizeof(a)); while(n--) { scanf("%d",&k); a[k+500000] 阅读全文

posted @ 2012-03-28 17:34 江财小子 阅读(163) 评论(0) 推荐(0)

hdu 3784 继续xxx定律
摘要:当n为3时,我们在验证xxx定律的过程中会得到一个序列,3,5,8,4,2,1,将3称为关键数,5,8,4,2称为覆盖数。现在输入n个数字a[i],根据关键数与覆盖数的理论,我们只需要验证其中部分数就可以确定所有数满足xxx定律,输出输入的n个数中的关键数。如果其中有多个关键数的话按照其输入顺序的逆序输出。Input输入数据包含多个用例,每个用例首先包含一个整数n,然后接下来一行有n个整数a[i],其中:1#include #include using namespacestd;boolh[200000];intmain(){ intn,m,i,k,a[503],b[503]; while(s 阅读全文

posted @ 2012-03-28 17:33 江财小子 阅读(267) 评论(0) 推荐(0)