2011年5月3日

EXCEL排序

摘要: #include<stdio.h>#include<stdlib.h>#include<string.h>#include<algorithm>using namespace std;int l=1,N,M;struct node{ char stu[10]; char name[10]; int grade;}T[100010];int cmp1(const void *a,const void *b){ return strcmp((*(node *)a).stu,(*(node *)b).stu);}int cmp2(const void 阅读全文

posted @ 2011-05-03 20:48 more think, more gains 阅读(200) 评论(0) 推荐(0) 编辑

Fibonacci Again 不可小瞧的一道题。

摘要: #include<stdio.h>#include<stdlib.h>#include<string.h>__int64 F[1000110];int main( ){ int i,n; while(scanf("%I64d",&n)!=EOF) { memset(F,0,sizeof(F)); F[0] = 7, F[1] = 11; for(i=2;i<=n;i++) F[i] = F[i-1... 阅读全文

posted @ 2011-05-03 19:28 more think, more gains 阅读(124) 评论(0) 推荐(0) 编辑

AC Me

摘要: #include<stdio.h>#include<stdlib.h>#include<string.h>char ch[100010],visit[27];int dp[27];int main( ){ int len,i,j; while(gets(ch)) { len=strlen(ch); memset(dp,0,sizeof(dp)); for(i=0;i<26;i++) visit[i... 阅读全文

posted @ 2011-05-03 18:39 more think, more gains 阅读(132) 评论(0) 推荐(0) 编辑

Elevator

摘要: #include<stdio.h>#include<string.h>#include<stdlib.h>int A[110],t=0;void fun(int x ){ if(x-1==-1) t+=A[x]*6+5; else if(A[x]>A[x-1]) t+=(A[x]-A[x-1])*6+5; else if(A[x]<A[x-1]) t+=(A[x-1]-A[x])*4+5; else if(A[x]==A[x-1]) t+=5; }int main( ){ int N,i; while(scanf("%d",& 阅读全文

posted @ 2011-05-03 17:34 more think, more gains 阅读(171) 评论(0) 推荐(0) 编辑

Number Sequence

摘要: #include<stdio.h>#include<stdlib.h>int main( ){ int A,B,n,i,j,k,f[60]; while(scanf("%d%d%d",&A,&B,&n),A||B||n) { f[1]=1; f[2]=1; for(i=3;i<=50;i++) { f[i] = (A * f[n - 1] + B * f[n - 2]) % 7; if(f[i]=... 阅读全文

posted @ 2011-05-03 16:19 more think, more gains 阅读(158) 评论(0) 推荐(0) 编辑

Let the Balloon Rise

摘要: #include<stdio.h>#include<string.h>int main( ){ char ch[1100][20]; int d[1100],visit[1100],N,M,i,j,t; while(scanf("%d",&N),N) { t=0; for(i=0;i<=N;i++) d[i]=1; memset(visit,0,sizeof(visit)); for(i=0;i<... 阅读全文

posted @ 2011-05-03 15:40 more think, more gains 阅读(206) 评论(0) 推荐(0) 编辑

Strange fuction

摘要: #include<stdio.h>#include<string.h>#include<stdlib.h>#include<math.h>double fun1(double x,double y){ return 6*x*x*x*x*x*x*x+8*x*x*x*x*x*x+7*x*x*x+5*x*x-y*x;}double fun2(double x,double y){ return 42*x... 阅读全文

posted @ 2011-05-03 01:16 more think, more gains 阅读(295) 评论(0) 推荐(0) 编辑

二分查找

摘要: #include<stdio.h>#include<string.h>#include<stdlib.h>int ab[1000];//二分查找 int find(int l,int r,int s) {while(l<=r){int mid=(l+r)>>1;if(ab[mid]==s) return 1;if(ab[mid]>s) r=mid-1; //注意这里不能写r=mid..否则死循环。else l=mid+1;}return 0;}int main( ){ int i; for(i=1;i<=60;i++) ab[i 阅读全文

posted @ 2011-05-03 00:46 more think, more gains 阅读(169) 评论(0) 推荐(0) 编辑

Can you solve this equation?

摘要: #include<stdio.h>#include<math.h>double fun(double x){ return 8*x*x*x*x + 7*x*x*x + 2*x*x + 3*x + 6 ;}int main( ){ int N,flag; double Y,a,b,mid; scanf("%d",&N); while(N--) { flag=0; scanf("%lf",&Y); a... 阅读全文

posted @ 2011-05-03 00:36 more think, more gains 阅读(230) 评论(0) 推荐(0) 编辑

导航