上一页 1 ··· 74 75 76 77 78 79 80 81 82 ··· 99 下一页

2011年4月29日

不容易系列之二

摘要: #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 阅读(131) 评论(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 阅读(198) 评论(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) 编辑

上一页 1 ··· 74 75 76 77 78 79 80 81 82 ··· 99 下一页

导航