2012年8月31日

poj2752 Seek the Name, Seek the Fame

摘要: http://poj.org/problem?id=2752水题一枚:next函数应用View Code 1 #include<stdio.h> 2 #include<string.h> 3 char str1[500005]; 4 int next[500005]; 5 int a[500005]; 6 void get_next(int x) 7 { 8 int i=0,j=-1; 9 next[0]=-1;10 while(i<x)11 {12 if(j==-1||str1[i]==str1[j])13 {14 ... 阅读全文

posted @ 2012-08-31 16:53 仁者无敌8勇者无惧 阅读(104) 评论(0) 推荐(0) 编辑

hdu 2594Simpsons’ Hidden Talents

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2594View Code 1 #include<stdio.h> 2 #include<string.h> 3 char str1[100010]; 4 char str2[50005]; 5 int next[1000010]; 6 int max(int x,int y) 7 { 8 return x=x>y?x:y; 9 }10 void get_next(int x)11 {12 13 int i=0,j=-1;14 next[0]=-1;15 while(i... 阅读全文

posted @ 2012-08-31 00:05 仁者无敌8勇者无惧 阅读(109) 评论(0) 推荐(0) 编辑

2012年8月30日

hdu 1358Period

摘要: PeriodTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 1326Accepted Submission(s): 637Problem DescriptionFor each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether 阅读全文

posted @ 2012-08-30 20:58 仁者无敌8勇者无惧 阅读(421) 评论(0) 推荐(0) 编辑

poj 2046Power Strings

摘要: View Code 1 #include<stdio.h> 2 #include<string.h> 3 char str[1000010]; 4 int next[1000010]; 5 int get_next(int x) 6 { 7 int i=0,j=-1; 8 next[0]=-1; 9 while(i<x)10 {11 if(j==-1||str[i]==str[j])12 {13 i++;14 j++;15 if(str[i]!=str[j]... 阅读全文

posted @ 2012-08-30 12:08 仁者无敌8勇者无惧 阅读(156) 评论(0) 推荐(0) 编辑

2012年8月29日

hdu 3577Fast Arrangement

摘要: View Code 1 #include<stdio.h> 2 #define Maxn 1000010 3 int a[Maxn],b[Maxn]; 4 struct Node 5 { 6 int l,r; 7 int sum;//子树最大覆盖 8 int ant;//本身被覆盖 9 }node[4*Maxn]; 10 int max(int a,int b) 11 { 12 13 14 15 return a=a>b?a:b; 16 17 } 18 void create_tree(int ll... 阅读全文

posted @ 2012-08-29 19:47 仁者无敌8勇者无惧 阅读(201) 评论(0) 推荐(0) 编辑

poj 2828 Buy Tickets

摘要: http://poj.org/problem?id=2828格式错了几次,以为要空行,坑!!倒过来推。。View Code 1 #include<stdio.h> 2 #define Maxn 200010 3 int n; 4 struct jiedian 5 { 6 int pos; 7 int value; 8 }jie[Maxn]; 9 struct Node10 {11 int l,r;12 int sum;13 int summ;14 15 }node[Maxn*4];16 int Min(int a,int b)17 {18 ... 阅读全文

posted @ 2012-08-29 11:36 仁者无敌8勇者无惧 阅读(127) 评论(0) 推荐(0) 编辑

2012年8月27日

hdu 1556 Color the ball

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1556Color the ballTime Limit: 9000/3000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4343Accepted Submission(s): 2325Problem DescriptionN个气球排成一排,从左到右依次编号为1,2,3....N.每次给定2个整数a b(a <= b),lele便为骑上他的“小飞鸽"牌电动车从气球a开始到气球b依次给 阅读全文

posted @ 2012-08-27 17:29 仁者无敌8勇者无惧 阅读(176) 评论(0) 推荐(0) 编辑

2012年8月26日

hdu 1431素数回文

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1431View Code 1 #include<stdio.h> 2 #include<string.h> 3 bool prime[10000002];//int一直超内存,wa好多次,改成bool就过了 4 int pos[664580]; 5 int num; 6 void puan_prim() 7 { 8 memset(pos,-1,sizeof(pos)); 9 num=0;10 memset(prime,false,sizeof(prime));11 for(... 阅读全文

posted @ 2012-08-26 19:36 仁者无敌8勇者无惧 阅读(184) 评论(0) 推荐(0) 编辑

2012年8月25日

nyoj 一个简单的数学题

摘要: http://acm.nyist.net/JudgeOnline/problem.php?pid=330View Code 1 #include<stdio.h> 2 #include<string.h> 3 int vis[1000005]; 4 int main() 5 { 6 int t; 7 int n; 8 scanf("%d",&t); 9 while(t--)10 {11 memset(vis,0,sizeof(vis));12 scanf("%d",&n);13 if(n==1)14 ... 阅读全文

posted @ 2012-08-25 11:12 仁者无敌8勇者无惧 阅读(109) 评论(0) 推荐(0) 编辑

2012年8月24日

nyoj 求余数

摘要: http://acm.nyist.net/JudgeOnline/problem.php?pid=205View Code 1 #include<stdio.h> 2 #include<string.h> 3 int main() 4 { 5 long long t; 6 int len; 7 char str[1000010]; 8 scanf("%lld",&t); 9 while(t--)10 {11 long long yushu=0;12 scanf("%s",str);13 len... 阅读全文

posted @ 2012-08-24 21:32 仁者无敌8勇者无惧 阅读(105) 评论(0) 推荐(0) 编辑

导航