2011年4月29日

A|B超水

摘要: #include<stdio.h>int main( ){ int N,a,b; scanf("%d",&N); while(N--) { scanf("%d%d",&a,&b); if(a%b==0) printf("YES\n"); else printf("NO\n");}return 0;} 阅读全文

posted @ 2011-04-29 22:27 more think, more gains 阅读(126) 评论(0) 推荐(0) 编辑

MAX NUM

摘要: #include<stdio.h>#include<algorithm>using namespace std;int main( ){ int t,i,N; double A[10000]; scanf("%d",&N); while(N--) { scanf("%d",&t); for(i=0;i<t;i++) scanf("%lf",&A[i]); sort(A,A+t); printf("%.2lf\n",A[t-1]); } return 0;} 阅读全文

posted @ 2011-04-29 22:24 more think, more gains 阅读(139) 评论(0) 推荐(0) 编辑

手机短号

摘要: #include<stdio.h>#include<string.h>int main( ){ char ch[15],*p,*q; int N,len; scanf("%d",&N); while(N--) { scanf("%s",ch); len=strlen(ch); p=ch; q=ch+len; printf("6"); for(p=ch+6;p<q;p++) printf("%c",*p); puts(""); } return 0;} 阅读全文

posted @ 2011-04-29 22:16 more think, more gains 阅读(137) 评论(0) 推荐(0) 编辑

算菜价

摘要: #include<stdio.h>int main( ){ char ch[100];double a,b,sum=0;while(scanf("%s%lf%lf",ch,a,b)!=EOF) sum+=a*b;printf("%.2lf\n",sum);return 0;}在编译器上是无法得结果的。直接提交。 阅读全文

posted @ 2011-04-29 22:10 more think, more gains 阅读(187) 评论(0) 推荐(0) 编辑

A==B

摘要: #include<stdio.h>#include<string.h>int main( ){ char a[100020],b[100020],c[100020],d[100020]; while(scanf("%s%s",a,b)!=EOF) { int i,j,k=0,m=0,n=0,len1,len2,f1=0,f2=0,f3=0,f4=0; len1=strlen(a); len2=st... 阅读全文

posted @ 2011-04-29 22:04 more think, more gains 阅读(155) 评论(0) 推荐(0) 编辑

Bitset

摘要: #include<stdio.h>int main(){ int A[120],N,i,j,k,t; while(scanf("%d",&t)!=EOF) { i=0; while(t) { A[i++]=t%2; t=t/2; } j=i; for(i=j-1;i>=0;i--) printf("%d",A[i]); puts("");}return 0;} 阅读全文

posted @ 2011-04-29 20:25 more think, more gains 阅读(155) 评论(0) 推荐(0) 编辑

密码

摘要: #include<stdio.h>#include<string.h>int main( ){ int N; scanf("%d",&N); while(N--) { int i,j,k,len,f1=0,f2=0,f3=0,f4=0,f5=0; char ch[60]; scanf("%s",ch); len=strlen(ch); if(len>=8&&len<=16) f1=1; for(i... 阅读全文

posted @ 2011-04-29 20:16 more think, more gains 阅读(145) 评论(0) 推荐(0) 编辑

不容易系列之二

摘要: #include<stdio.h>int main( ){ int N; scanf("%d",&N); while(N--) { int t,i,sum=3; scanf("%d",&t); for(i=1;i<=t;i++) sum=2*sum-2; printf("%d\n",sum);}return 0;}简单题。 阅读全文

posted @ 2011-04-29 20:07 more think, more gains 阅读(132) 评论(0) 推荐(0) 编辑

超级楼梯

摘要: #include<stdio.h>int fun(int x){ if(x==1) return 1; else if(x==2) return 1; else if(x==3) return 2; else return fun(x-1)+fun(x-2);}int main( ){ int N,t; scanf("%d",&N); while(N--) { scanf("%d",&t); printf("%d\n",fun(t)); } return 0;}超时。。TLE …看来需要打表。。#inclu 阅读全文

posted @ 2011-04-29 19:59 more think, more gains 阅读(207) 评论(0) 推荐(0) 编辑

亲和数

摘要: #include<stdio.h>int fun(int x){ int i,j,sum=0; for(i=1;i<x;i++) if(x%i==0) sum+=i; return sum;}int main( ){ int N; scanf("%d",&N); while(N--) { int a,b; scanf("%d%d",&a,&b); if((fun(a)==b)&&(fun(b)==a)) printf("YES\n"); else printf("NO 阅读全文

posted @ 2011-04-29 19:52 more think, more gains 阅读(199) 评论(0) 推荐(0) 编辑

三角形

摘要: #include<stdio.h>int main( ){ int N; scanf("%d",&N); while(N--) { float a,b,c; scanf("%f%f%f",&a,&b,&c); if(a+b>c&&a+c>b&&b+c>a) printf("YES\n"); else printf("NO\n"); } return 0;} 刚开始设了int型。。wa.. 阅读全文

posted @ 2011-04-29 19:36 more think, more gains 阅读(128) 评论(0) 推荐(0) 编辑

今年暑假不AC

摘要: #include<stdio.h>#include<algorithm>using namespace std;struct node{ int s,e;}T[120];int cmp(node a,node b){ return a.e<b.e; }int main( ){ int N,i,j,k,m,n; while(scanf("%d",&N),N) { int num=0,temp; for(i=0;i<N;i++) scanf("%d%d",&T[i].s,&T[i].e); sort 阅读全文

posted @ 2011-04-29 18:52 more think, more gains 阅读(167) 评论(0) 推荐(0) 编辑

改革春风吹满地

摘要: /*可以利用多边形求面积公式:S = 0.5 * ( (x0*y1-x1*y0) + (x1*y2-x2*y1) + ... + (xn*y0-x0*yn) )其中点(x0, y0), (x1, y1), ... , (xn, yn)为多边形上按逆时针顺序的顶点。*/#include<stdio.h>int main( ){ int N,A[1000],B[1000],i; while(scanf... 阅读全文

posted @ 2011-04-29 17:09 more think, more gains 阅读(213) 评论(0) 推荐(0) 编辑

人见人爱A^B

摘要: #include<stdio.h>int main(){ int N,M,i,j; while(scanf("%d%d",&N,&M),N||M) { j=N; for(i=1;i<M;i++) { N=N*j; while(N>1000) N=N%1000; } printf("%d\n",N); } return 0;} 阅读全文

posted @ 2011-04-29 16:51 more think, more gains 阅读(139) 评论(0) 推荐(0) 编辑

人见人爱A-B

摘要: #include<stdio.h>#include<stdlib.h>#include<string.h>#include<algorithm>using namespace std;/*int cmp(const void *a,const void *b){ return *(int *)a > *(int *)b ?1 :-1;}*/int main( ){ int N,M,i,j,k,A[10000],B[10000],visit[10000]; while(scanf("%d%d",&N,&M) 阅读全文

posted @ 2011-04-29 16:35 more think, more gains 阅读(332) 评论(0) 推荐(0) 编辑

人见人爱A+B

摘要: #include<stdio.h>int main( ){ int N; scanf("%d",&N); while(N--) { int a1,a2,a3,b1,b2,b3; scanf("%d%d%d%d%d%d",&a1,&a2,&a3,&b1,&b2,&b3); if(a3+b3>=60) a2++,a3=a3+b3-60; else a3+=b3; if(a2+b2>=60) a1++,a2=a2+b2-60; else a2+=b2; a1+=b1; printf 阅读全文

posted @ 2011-04-29 14:19 more think, more gains 阅读(211) 评论(0) 推荐(0) 编辑

杨辉三角

摘要: #include<stdio.h>#include<string.h>int main( ){ int N,i,j; while(scanf("%d",&N)!=EOF) { int A[31][31]; memset(A,0,sizeof(A)); for(i=0;i<=N;i++) A[i][0]=1; for(i=1;i<N;i++) for(j=1;j<N;j++) A[i][j]=A[i-1][j-1]+A[i-1][j]; for(i=0;i<N;i++) { for(j=0;j<=i;j++) pr 阅读全文

posted @ 2011-04-29 14:11 more think, more gains 阅读(212) 评论(0) 推荐(0) 编辑

最小公倍数

摘要: #include<stdio.h>long long n;long long gcd( long long n,long long m ){ return m ? gcd( m,n % m ):n;}long long cal( ){ long long sum = 1,c; for( long long i = 1; i <= n; ++i ) scanf( "%I64d",&c ),sum =... 阅读全文

posted @ 2011-04-29 13:57 more think, more gains 阅读(162) 评论(0) 推荐(0) 编辑

汉字统计

摘要: #include<stdio.h>#include<string.h>int main( ){ int N; scanf("%d",&N); getchar(); while(N--) { int len,i,num=0; char ch[10000]; gets(ch); len=strlen(ch); for(i=0;i<len;i++) if(ch[i]<0) num++; printf("%d\n",num/2); } return 0;} 阅读全文

posted @ 2011-04-29 13:55 more think, more gains 阅读(128) 评论(0) 推荐(0) 编辑

回文数

摘要: #include<stdio.h>#include<string.h>int main( ){ int N,len; scanf("%d",&N); while(N--) { int flag=0; char ch[100],*p,*q; scanf("%s",ch); len=strlen(ch); for(p=ch,q=ch+len-1;p<=q;p++,q--) if(*p!=*q) {pu... 阅读全文

posted @ 2011-04-29 13:55 more think, more gains 阅读(161) 评论(0) 推荐(0) 编辑

导航