上一页 1 ··· 35 36 37 38 39 40 41 42 43 ··· 47 下一页

2012年4月23日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2740题意:找到A,另A^N最接近B思路:逆向考虑,B^(1/n)上下取整,在各取N次幂,看哪个更接近Bps:注意上下取整View Code #include <stdio.h>#include <math.h>int main(){ int b,n; double temp; int p,q; while(scanf("%d%d",&b,&n),(b||n)) { temp=pow(b*1.0,1.0/n); p=floor(temp);//向下取 阅读全文
posted @ 2012-04-23 19:09 LegendaryAC 阅读(212) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1789贪心,按价值从大到小排序,然后尽可能的安排到截止时间View Code #include <stdio.h>#include <stdlib.h>#include <string.h>typedef struct L{ int a,b;}L;L kk[1100];int cmp(const void*a,const void*b){ L*c=(L*)a; L*d=(L*)b; if(c->b==d->b) return c->a-d->a; r 阅读全文
posted @ 2012-04-23 14:34 LegendaryAC 阅读(124) 评论(0) 推荐(0) 编辑

2012年4月22日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2317题意:判断做不做广告。胡搞题,看眼sample凑活一写就过了View Code #include <stdio.h>int main(){ int n,r,e,c,f; scanf("%d",&n); while(n--) { scanf("%d%d%d",&r,&e,&c); f=r-e+c; if(f<0)puts("advertise"); else if(f==0)puts(" 阅读全文
posted @ 2012-04-22 22:04 LegendaryAC 阅读(211) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1257和POJ和2533一模一样。。。View Code #include <stdio.h>#include <string.h>#include <stdlib.h>int cmp(const void*a,const void*b){ return *(int*)b-*(int*)a;}int main(){ int n,i,j; int a[1100],dp[1100]; while(~scanf("%d",&n)) { for(i=0; 阅读全文
posted @ 2012-04-22 21:14 LegendaryAC 阅读(174) 评论(0) 推荐(0) 编辑
 
摘要: http://poj.org/problem?id=2533最长上升子序列,dpView Code #include <stdio.h>#include <string.h>#include <stdlib.h>int cmp(const void*a,const void*b){ return *(int*)b-*(int*)a;}int main(){ int n,i,j; int a[1100],dp[1100]; while(~scanf("%d",&n)) { for(i=0;i<n;i++) scanf(&quo 阅读全文
posted @ 2012-04-22 20:55 LegendaryAC 阅读(157) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1163脑袋疼的厉害,写完没调试直接交,居然把%d写成%c,导致wa一次。。。这题感觉前两天刚做过一道一样的。。。HDOJ的题目很多无脑重复啊。。View Code #include <stdio.h>int main(){ int n; int i,s; while(scanf("%d",&n),n) { s=1; for(i=0;i<n;i++) s=s*n%9; if(s==0) printf("... 阅读全文
posted @ 2012-04-22 16:29 LegendaryAC 阅读(166) 评论(0) 推荐(0) 编辑

2012年4月21日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=1231最大连续子序列,水View Code #include <stdio.h>#include <stdlib.h>int cmp(const void*a,const void*b){ return *(int*)b-*(int*)a;}int a[110000];int main(){ int n,i; int max,now; int start,end; int temp; int p,q; while(scanf("%d",&n),n) { .. 阅读全文
posted @ 2012-04-21 20:17 LegendaryAC 阅读(165) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2571dp。wa两次,设边从1开始,所以和0有关的除了ans[1][0]和ans[0][1]外都要初始化为无穷(不让从外面进来)View Code #include <stdio.h>int map[30][1100];int ans[30][1100];#define INF -100000000int max(int a,int b){ return a>b?a:b;}int main(){ int n,m; int t; int i,j,k; scanf("%d", 阅读全文
posted @ 2012-04-21 20:05 LegendaryAC 阅读(154) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4224。。。对这题目无语了,本来是秒杀的题目就是让你读不懂。。。View Code #include <stdio.h>#include <string.h>#include <stdlib.h>int main(){ int x1,y1,x2,y2,x3,y3; int t,nCase=1; scanf("%d",&t); while(t--) { scanf("%d%d%d%d%d%d",&x1,&y1,& 阅读全文
posted @ 2012-04-21 16:53 LegendaryAC 阅读(329) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=4147小学生英文阅读题View Code #include <stdio.h>#include <string.h>#include <stdlib.h>#define INF 100000000int main(){ int n,B,D,f,F; int sum,min,len; int i,j; char s[1100]; while(~scanf("%d%d%d%d%d%*c",&n,&B,&D,&f,&F) 阅读全文
posted @ 2012-04-21 16:25 LegendaryAC 阅读(252) 评论(0) 推荐(0) 编辑
上一页 1 ··· 35 36 37 38 39 40 41 42 43 ··· 47 下一页