
各种不解
vsooda
这个作者很懒,什么都没留下…
展开
-
1069 qsort你这是什么状况,printf一下个别结构体的值发生变化?
#include #include #include struct rect { int x; int y; int z; }r[32]; struct sh { int s; int height; }s[100]; int cmp(const void *lhs,const void *rhs) { struct sh *a=(struct sh*)lhs; struct sh原创 2012-02-25 13:27:12 · 863 阅读 · 0 评论 -
HDU1215 与1406类似,但是要注意超时(cout 和 printf的区别!!!)
AC版本: #include #include using namespace std; int fuc(int a) { int sum = 1; int b = sqrt(1.0 * a); for(int i = 2; i <= b; i++) { if(a % i == 0) { sum += i; int t = a / i; if(t !=原创 2012-09-17 16:29:16 · 895 阅读 · 0 评论 -
HDU 1025 高效最长上升子序列(二分查)
用到了LIS(Longest Increasing Subsequence)最长上升(不下降)子序列,它有两种算法复杂度为O(n*logn)和O(n^2)。前者使用二分查找,后者朴素查找。它的算法大致思路:设置两个a,b数组,a数组存储数据,b数组存储最长不降序序列。此算法关键在于设计二分查找。 刚开始用到了朴素dp算法,果断超时,超时代码为: #include #include usi原创 2012-09-19 10:41:07 · 1442 阅读 · 3 评论