自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(10)
  • 收藏
  • 关注

原创 POJ 2709 混合颜料 acm 贪心

Description杂货店出售一种由N(3也就是它不属于这N种之一。幸运的是,灰色颜料是比较好配置的,如果你取出三种不同颜色的颜料各xml,混合起来就可以得到x ml的灰色颜料(注意不是3x)。现在,你知道每种颜料各需要多少ml。你决定买尽可能少的“颜料套装”,来满足你需要的这N+1种颜料。那么你最少需要买多少个套装呢?Input输

2015-08-04 10:58:38 854

原创 CSU 1548 Road And Bridge acm 三分

DescriptionYou need to design road from (0, 0) to (x, y) in plane with the lowest cost. Unfortunately, there are N Rivers between (0, 0) and (x, y).It costs c1 Yuan RMB per meter to build road,

2015-08-04 10:55:31 312

原创 CodeForces 405B Playing Dominoes acm 模拟题

DescriptionLittle Chris knows there's no fun in playing dominoes, he thinks it's too random and doesn't require skill. Instead, he decided to playwith the dominoes and make a "domino show".Chr

2015-08-04 10:40:38 404

原创 CSU 1469 Change The Handles acm 模拟题

Description  There are N·M handles on the ground. Every handle can be in one of two states: open or closed. The handles are represented as anN·M matrix. You can change the state of handl

2015-08-04 10:22:28 255

原创 acm解题报告 POJ 2366 Sacrament of the sum

使用二分加暴力的方法可以解决这题,对第一个序列遍历,第二个序列进行二分查找。时间复杂度:n*log(2)n源代码:#includeint a[50010], b[50010];int main(){ int n1, n2; scanf("%d", &n1); for (int i = 0; i  scanf("%d", &n2); for (int i = 0;

2015-07-23 10:39:08 381

原创 acm解题报告 HDU 1061 Rightmost Digit

要得到最右边那一位数字只需将N^Nmod10即可,但是当N很大时,N^N算不出来,所以需要用上同余的性质,即(a^b)mod c=(a^(b mod c))mod c。所以求N^Nmod10的快速方法是对幂数N进行二分,如果N为偶数则N^N=N^(N/2)*N^(N/2),如果为奇数N^N=N^(N/2)*N^(N/2)*N。源代码:#includelong long rightm

2015-07-23 10:24:22 292

原创 acm解题报告 HDU 1969 Pie

因为题目要求分给每个人的派都是来自一个派的而不是拼接的,所以没人得到的派大小一定小于最的大派,先从大到小排序。然后对第一个(最大的派)进行二分操作,low=0,high=最大派的大小。mid=(high+low)/2。判断如果以这个大小能否得到指定块数的派。源代码:#include#include#define pi 3.14159265358979323846using na

2015-07-23 10:12:01 453

原创 acm解题报告 HDU 2899 Strange fuction

首先将方程求导,发现从0到导数为零的范围,原方程递减,之后方程递增,所以求出导数为0的点即为最小值点,与HDU 2199 类似,通过二分的方法找到精确的最小值点,然后带到原方程中即得到最小值。源代码:#includedouble cal1(double x, double y){ double a = 6 * x*x*x*x*x*x*x + 8 * x*x*x*x*x*

2015-07-23 09:53:02 294

原创 acm解题报告 HDU 2199 Can you solve this equation?

由于方程式单调递增的,所以直接使用二分,找到误差不超过0.00005的解就可以了。源代码:#includedouble cal(double a){ double y = 8 * a*a*a*a + 7 * a*a*a + 2 * a*a + 3 * a + 6; return y;}double decimal(double a){ double b=0; r

2015-07-23 09:46:43 249

原创 acm解题报告 HDU 2141 Can you find it?

如果使用最暴力的方法,那么时间复杂度是500*500*500*1000=1.25e11>>3*3*10e8.所以肯定超时了,如果使用二分的方法,时间复杂度为500*500*log(2)500*1000≈1.3e9>9*10e8。还是会超时,但是如果现将前两个数组两两相加的结果存在一个新数组并排好序后使用二分,时间复杂度为500*500+2*log(2)500+1000*500*2*log(2)50

2015-07-23 09:30:08 372

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除