雕刻时光

just do it……nothing impossible
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 50 下一页

2012年1月11日

摘要: 规定内存限制为3mb在一个数列里n个数,输出不为m个数字的那个数5 32 2 3 3 3 输出39 21 1 3 2 2 3 3 4 4 输出39 41 2 2 1 2 1 2 3 1 输出3开a[64]的数组记录二进制转化好的数最后对该数组取余%m在对应的/(n%m)数组转化为数字即可View Code #include<stdio.h>#include<string.h>int a[64]; int main(){ int n,m; while(scanf("%d%d",&n,&m)!=EOF) { int i,temp,add; 阅读全文

posted @ 2012-01-11 09:38 huhuuu 阅读(245) 评论(0) 推荐(0) 编辑

2012年1月10日

摘要: 疲劳奔跑,求最长跑了多少一开始没有看到题目的特殊性,一旦休息,就一直休息直到疲劳度为0dp[i][j] i表示到第i个跑点,j表示当时的疲劳度时最大,WA其实考虑了特殊性就是0,1背包了add[i]表示1-i的和dp[i]=max(dp[i],dp[i-j*2]+add[i-j]-add[i-2*j]);View Code #include<stdio.h>int dp[10009];int add[10009];int max(int a,int b){ if(a>b)return a; else return b;}int main(){ int n,m; whil... 阅读全文

posted @ 2012-01-10 09:32 huhuuu 阅读(335) 评论(0) 推荐(0) 编辑

2012年1月9日

摘要: 每头牛在一定的时间段里挤奶,一共N个时间段,长度M,求最大挤奶量(类似于最大递增子序和1,3,2,4,3,6 最大和14)先排序,使时间段有序在求最大递增子序和View Code #include<stdio.h>#include<iostream>#include<algorithm>using namespace std;struct data{ int s; int e; int p;}s[1009];int dp[1009];bool cmp(data a,data b){ if(a.s==b.s) return a.e; else ... 阅读全文

posted @ 2012-01-09 10:55 huhuuu 阅读(625) 评论(0) 推荐(0) 编辑

摘要: 为什么我们会用二分,三分查找?因为我们不知道一个题目的准确答案,可以用二分,三分查找逼近答案如果一个问题是明显的单调性的话,用二分一个问题是明显的凸函数的话,三分而问题的重点是如何写出函数,还有函数上下限的控制!!! 阅读全文

posted @ 2012-01-09 09:49 huhuuu 阅读(201) 评论(0) 推荐(0) 编辑

摘要: 将一段数列左右取,all+=th*s[i]求最大和是多少左右取涉及到两个动作,故开个二维dp[i][j]=max(dp[i-1][j]+s[i]*(i+j),dp[i][j-1]+s[n-j+1]*(i+j));View Code #include<stdio.h>#include<string.h>int s[2009];int dp[2009][2009];int max(int a,int b){ if(a>b)return a; else return b;}int main(){ int n; while(scanf("%d",&am 阅读全文

posted @ 2012-01-09 09:10 huhuuu 阅读(409) 评论(0) 推荐(0) 编辑

2012年1月8日

摘要: 三分主要推出fun函数fun(A)的意义就是在原来坐标上的点经过A弧度逆旋转后,正方形(边与坐标轴平行)最小边长要多长fun()在旋转的时候符合凸函数,所以三分求最值View Code #include<stdio.h>#include<math.h>#include<iostream>using namespace std;const double maxn=0xfffffffffffff;const double minn=-0xfffffffffffff;const double PI=acos(-1.0);double x[39],y[39];int 阅读全文

posted @ 2012-01-08 21:37 huhuuu 阅读(851) 评论(0) 推荐(0) 编辑

摘要: 随着人的移动,求影子长短的变化,求最长先写凸函数,注意是分段函数double temp=h*1.0/H*d; double y; if(x<temp) y=(x*H-h*d)/(-d+x)+x; else y=(d-x)*h*1.0/H;三分模板一套就0了View Code #include<stdio.h>double ll,rr,mid,midmid,H,h,d;double fun(double x){ double temp=h*1.0/H*d; double y; if(x<temp) y=(x*H-h*d)/(-d+x)+x; else ... 阅读全文

posted @ 2012-01-08 20:26 huhuuu 阅读(239) 评论(0) 推荐(0) 编辑

2011年12月21日

摘要: View Code #include<stdio.h>#include<iostream>using namespace std;#include "huchao.h"#include "huchao_i.c"#include "atlbase.h"int main(int argc, char* argv[]){ Icom *Imycom; //COM接口1的初始化 HRESULT hResult; //HRESULT返回值用于看函数执行状态 GUID g_clsid; //定义一个标识符 ::CoIniti 阅读全文

posted @ 2011-12-21 15:22 huhuuu 阅读(980) 评论(0) 推荐(1) 编辑

2011年12月7日

摘要: http://poj.org/problem?id=2376题目:问有N头牛,每头牛的工作时间不同,要工作T小时,最少需要几头牛工作思路:一开始以为排序就可以过了,TLE了两次,25000*25000不优化会超啊,果断另开一个数组,把排序后最优的数据放进去再选择如1 41 92 7其实优化下就剩下1 9View Code #include<stdio.h>#include<iostream>#include<algorithm>using namespace std;struct data{ int ll,rr;}s[25009],end[25009];in 阅读全文

posted @ 2011-12-07 21:11 huhuuu 阅读(364) 评论(0) 推荐(0) 编辑

2011年12月5日

摘要: http://poj.org/problem?id=1948题目描述:给最多40根木棍,每根长度不超过40,要用完所有的木棍构成面积最大的三角形,求出最大的面积。f[j][k] 表示能否达到一边长为 j,另一边长为kif(j>=a[i])f[j][k]=f[j][k]||f[j-a[i]][k]if(k>=a[i])f[j][k]=f[j][k]||f[j][k-a[i]]View Code #include<stdio.h>#include<string.h>#include<math.h>#include<iostream>usi 阅读全文

posted @ 2011-12-05 21:22 huhuuu 阅读(273) 评论(0) 推荐(0) 编辑

上一页 1 ··· 25 26 27 28 29 30 31 32 33 ··· 50 下一页