X-man

导航

上一页 1 ··· 46 47 48 49 50 51 52 53 54 ··· 59 下一页

2013年5月13日 #

xiangtan OJ God Lin’s Harem

摘要: http://202.197.224.59/OnlineJudge2/index.php/Problem/read/id/1159#include<stdio.h>#include<string.h>#include<set>#include<vector>using namespace std;struct node{ int num; int like; friend bool operator <(node a, node b) { if(a.like>b.like)return true; if(a.like==b.like& 阅读全文

posted @ 2013-05-13 17:43 雨钝风轻 阅读(285) 评论(0) 推荐(0) 编辑

XiangTan University1163 查询成绩

摘要: #include<stdio.h>#include<string>#include<string.h>#include<iostream>using namespace std;string s1,s2;int main(){ char a[200]; char b[200]; int i,j,k; while(scanf("%s %s",a,b+1)!=EOF) { b[0]='*';//正确密码的片段(可能首缺) s1=a; s2=b; i=0,j=0,k=0; //s2.push_fron... 阅读全文

posted @ 2013-05-13 11:51 雨钝风轻 阅读(176) 评论(0) 推荐(0) 编辑

2013年5月12日 #

hdu 1164 Eddy's research I

摘要: #include<stdio.h>#include<string.h>#include<math.h>bool visit[100000];int prime[100000];int n;int x;int init_pri(){ memset(visit,true,sizeof(visit)); int num=0; for(int i=2;i<=n;i++) { if(visit[i]==true) { num++; prime[num]=i; } for(int j... 阅读全文

posted @ 2013-05-12 21:08 雨钝风轻 阅读(139) 评论(0) 推荐(0) 编辑

hdu 1242 Rescue

摘要: #include<stdio.h>#include<string.h>#include<queue>using namespace std;struct node{ int x,y; int time; friend bool operator<(node a,node b) { if(a.time>b.time)return true;//越小越优先 return false; }}in,im;int f[4][2]= {{-1,0},{1,0},{0,-1},{0,1}};int n,m;int startx,starty,ans;... 阅读全文

posted @ 2013-05-12 11:30 雨钝风轻 阅读(186) 评论(0) 推荐(0) 编辑

2013年5月10日 #

Manacher算法(O(n)回文子串算法)

摘要: 1.奇数的回文串和偶数的回文串统一起来考虑先在每两个相邻字符中间插入一个分隔符,当然这个分隔符要在原串中没有出现过。一般可以用‘#’分隔。这样就非常巧妙的将奇数长度回文串与偶数长度回文串统一起来考虑了(见下面的一个例子,回文串长度全为奇数了)2.用一个辅助数组P记录以每个字符为中心的最长回文串的信息。3.P[id]记录的是以字符str[id]为中心的最长回文串,当以str[id]为第一个字符,这个最长回文串向右延伸了P[id]个字符原串:w aa bwsw f d 新串: # w # a # a #b # w # s # w # f # d #辅助数组P: 1 2 1 2 3 2 1 ... 阅读全文

posted @ 2013-05-10 19:43 雨钝风轻 阅读(230) 评论(0) 推荐(0) 编辑

[USACO 1.5.3]特殊的质数肋骨

摘要: #include<stdio.h>#include<string.h>#include<math.h>int m;int a[4]={2,3,5,7};int b[4]={1,3,7,9};int c[10];int number;bool visit[101000];int prime[100000];int n=100000;int init_prim(){ memset(visit,true,sizeof(visit)); int num=0; for(int i=2;i<=n;i++) { if(visit[i]==true) { ... 阅读全文

posted @ 2013-05-10 14:36 雨钝风轻 阅读(384) 评论(0) 推荐(0) 编辑

2013年5月9日 #

hdu 1312 Red and Black

摘要: #include<stdio.h>int w,h,ans;char a[30][30];int d[4][2]={{0,-1},{0,1},{1,0},{-1,0}};int dfs(int i,int j){ int ii,jj; for(int k=0;k<4;k++) { ii=i+d[k][0]; jj=j+d[k][1]; if(ii<h&&jj<w&&ii>=0&&jj>=0&&a[ii][jj]=='.') { ans++; a[ii][jj]='#& 阅读全文

posted @ 2013-05-09 18:37 雨钝风轻 阅读(189) 评论(0) 推荐(0) 编辑

hdu 1241 Oil Deposits

摘要: #include<stdio.h>#include<string.h>char a[110][110];int f[8][2]={{0,1},{0,-1},{-1,1},{-1,0},{-1,-1},{1,-1},{1,0},{1,1}};int m,n;int dfs(int i,int j){ for(int k=0;k<8;k++) { int x=i+f[k][0]; int y=j+f[k][1]; if(x>=0&&y>=0&&x<m&&y<n&&a[x][y]== 阅读全文

posted @ 2013-05-09 18:10 雨钝风轻 阅读(181) 评论(0) 推荐(0) 编辑

2013年5月8日 #

信心题

摘要: http://ch.vijos.org/Contest/%E6%B9%96%E5%8C%97%E7%9C%81%E9%98%9F%E4%BA%92%E6%B5%8B%20Week1/Problem/Show/%E4%BF%A1%E5%BF%83%E9%A2%98#include<stdio.h>#include<math.h>long long mod,t;long long sum(long long x,long long y){ t=x+y; if(x%2==0)x/=2;//x&1==0 不能用 else if(y%2==0)y/=2; else t/= 阅读全文

posted @ 2013-05-08 16:33 雨钝风轻 阅读(182) 评论(0) 推荐(0) 编辑

2013年5月7日 #

友谊圈(Easy)

摘要: http://ch.vijos.org/Contest/%E3%80%8CAdera%203%E3%80%8D%E6%9D%AF%E7%9C%81%E9%80%89%E6%A8%A1%E6%8B%9F%E8%B5%9B/Problem/Show/%E5%8F%8B%E8%B0%8A%E5%9C%88(Easy)错误的dp初始化代码View Code #include<stdio.h>#include<string.h>int a[20100];int dp[20100];int main(){ int n,max,m; int i,j; while(scanf(&quo 阅读全文

posted @ 2013-05-07 22:52 雨钝风轻 阅读(217) 评论(0) 推荐(0) 编辑

上一页 1 ··· 46 47 48 49 50 51 52 53 54 ··· 59 下一页