摘要: View Code 1 #include<cstdio> 2 #include<cstdlib> 3 #define N 12 4 int f[N][N]; 5 6 int init(int m,int n){ 7 int i,j; 8 if(m==1||n==1)return 1; 9 else if(m==n) return init(m,n-1)+1;10 else if(m<n) return init(m,m);11 else if(m>n) return init(m,n-1)+init(m-n,n);12 }13 14 int main... 阅读全文
posted @ 2012-10-11 20:54 xxx0624 阅读(467) 评论(0) 推荐(1) 编辑
摘要: 这道题主要注意精度问题就行。还有就是二分的时候,left=mid+1或者left=mid;都行。不过个人更喜欢mid+1。View Code 1 #include<cstdio> 2 #include<cstring> 3 #include<cmath> 4 #define eps 0.0000000001 5 using namespace std; 6 double n,p; 7 void solve(){ 8 long long right,left,mid; 9 double tmp;10 left=0;11 right=1000000002;12 阅读全文
posted @ 2012-10-11 20:25 xxx0624 阅读(353) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<cstdio> 2 #include<cstring> 3 #define N 4 4 int map[N+1][N+1]; 5 int main(){ 6 int i,j,k,ans; 7 char c; 8 memset(map,0,sizeof(map)); 9 ans=0;10 for(i=0;i<N;i++){11 for(j=0;j<N;j++){12 scanf("%c",&c);13 if(j==3)getchar();14 ... 阅读全文
posted @ 2012-10-11 19:45 xxx0624 阅读(303) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>#include<stdlib.h>#include<string.h>#define N 1000005int next[N],len1,len2,ans;char s1[N],s2[N];void getnext(){ int k,j; len1=strlen(s1); next[0]=-1; j=0; k=-1; while(j<len1){ if(k==-1||s1[k]==s1[j]){ k++; j++; next[j]=k; } else k=next[k]; } return ;}int kmp(){ 阅读全文
posted @ 2012-09-27 11:41 xxx0624 阅读(545) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>#include<stdlib.h>int cmp( const void *a , const void *b ) { return *(double *)a > *(double *)b ? 1 : -1; }int main(){ int t,i,j,n,v,ansv,tpcnt; double s,ansp,tp; double a[110]; scanf("%d",&t); while(t--){ scanf("%d%d%lf",&n,&v,&s); 阅读全文
posted @ 2012-08-12 21:42 xxx0624 阅读(278) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。 阅读全文
posted @ 2012-08-11 10:34 xxx0624 阅读(10) 评论(0) 推荐(0) 编辑
摘要: View Code 1 #include<cstdio> 2 #include<cstdlib> 3 #include<cstring> 4 #include<iostream> 5 #include<queue> 6 #include<algorithm> 7 #define N 55 8 int map[N][N][N]; 9 int a,b,c,maxt,ans;10 int fmin(int i,int j){11 return i>j?j:i;12 }13 using namespace std;14 st 阅读全文
posted @ 2012-08-05 19:19 xxx0624 阅读(464) 评论(0) 推荐(0) 编辑
只有注册用户登录后才能阅读该文。 阅读全文
posted @ 2012-08-05 10:12 xxx0624 阅读(5) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>#include<string.h>#include<stdlib.h>#define N 1005int map[N][N];int vis[N][N];int n,ans,now_k;const int dx[]={0,0,-1,1};const int dy[]={-1,1,0,0};void dfs(int sx,int sy){ int i,tx,ty; if(ans==n){ return ; } for(i=0;i<4;i++){ tx=sx+dx[i]; ty=sy+dy[i]; if(tx<1| 阅读全文
posted @ 2012-08-04 19:50 xxx0624 阅读(261) 评论(0) 推荐(0) 编辑
摘要: #include<stdio.h>#include<stdlib.h>#include<math.h>struct g{ double l,r;}point[1005];int cmp(const void *a,const void *b){ return (*(struct g *)a).l>(*(struct g *)b).l?1:-1;}int main(){ int i,n,tcase=1,ans; double a,b; bool flag; double dis,temp; scanf("%d%lf",&n,& 阅读全文
posted @ 2012-08-04 13:55 xxx0624 阅读(179) 评论(0) 推荐(0) 编辑