上一页 1 ··· 43 44 45 46 47

2012年4月4日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2673排序题,汗。。。View Code #include <stdio.h>#include <stdlib.h>int cmp(const void*a,const void*b){ return *(int*)a-*(int*)b;}int a[11000];int main() { int n; int i,f,cnt1,cnt2; while(~scanf("%d",&n)) { for(i=0;i<n;i++) scanf("%d 阅读全文
posted @ 2012-04-04 13:18 LegendaryAC 阅读(249) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2674n大于等于2009时取余为0,只要算2009前面的就okView Code #include <stdio.h>#include <stdlib.h>int main() { int n; int ans,i; while(~scanf("%d",&n)) { ans=1; if(n>=2009) printf("0\n"); else { for(i=1;i<=n;i++) ... 阅读全文
posted @ 2012-04-04 13:05 LegendaryAC 阅读(239) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.bjtu.edu.cn/problem/detail?pid=1623贪心,关键点是以课程的结束时间为标准排序View Code #include <stdio.h>#include <stdlib.h>struct node{ __int64 x,y;}kk[110000];int cmp(const void*a,const void*b){ struct node*c=(struct node*)a; struct node*d=(struct node*)b; if(d->y==c->y) return d->x-c-&g 阅读全文
posted @ 2012-04-04 12:40 LegendaryAC 阅读(197) 评论(0) 推荐(0) 编辑
 
摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2570这道题WA了十多次,百思不得其解,百度了一组数据12 1 65 7实数运算一定要修正误差View Code #include <stdio.h>#include <stdlib.h>int cmp(const void*a,const void*b){ return *(int*)a-*(int*)b;}int main() { int t,n,cnt; int v,w,p[200]; int i,j,f; double q,rz,ry; scanf("%d" 阅读全文
posted @ 2012-04-04 11:44 LegendaryAC 阅读(519) 评论(0) 推荐(0) 编辑

2012年2月28日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2602吾近来又开始翻阅背包九讲,确是神作,又有所感,故水01背包一道祭天。View Code #include <stdio.h>#include <string.h>int main(){ int T,N,V; int i,j; int f[1100],c[1100],w[1100]; scanf("%d",&T); while(T--) { scanf("%d%d",&N,&V); memset(f,0,sizeof( 阅读全文
posted @ 2012-02-28 13:16 LegendaryAC 阅读(154) 评论(0) 推荐(0) 编辑

2011年12月30日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2086找规律,自己推公式。View Code #include <stdio.h>int main(){ int n,i; double a0,a1,n1,a[5000]; while(~scanf("%d",&n)) { scanf("%lf%lf",&a0,&n1); for(i=0;i<n;i++) scanf("%lf",&a[i]); a1=n*a0+n1; for(i=1;i<=n; 阅读全文
posted @ 2011-12-30 18:41 LegendaryAC 阅读(304) 评论(0) 推荐(0) 编辑

2011年12月27日

摘要: http://acm.hdu.edu.cn/showproblem.php?pid=2067这道题的状态我很久以前就分析过了,是一道递推题,当初感觉思维很乱没写出来。今天好好研究了一下动态规划,发现用动态规划中记忆化搜索的思想能解决此问题。View Code #include <stdio.h>#include <string.h>int n,flag=1; __int64 d[100][100]; __int64 f(int i,int j) { if(d[i][j]>=1)return d[i][j]; if(j==1)return d[i][j]=i; if 阅读全文
posted @ 2011-12-27 21:52 LegendaryAC 阅读(205) 评论(0) 推荐(0) 编辑
上一页 1 ··· 43 44 45 46 47