码迷,mamicode.com
首页 >  
搜索关键字:hdu5328    ( 4个结果
解题报告 之 HDU5328 Problem Killer
You are a "Problem Killer", you want to solve many problems. Now you have problems, the -th problem's difficulty is represented by an integer (). For some strange reason, you must choose some integer and (), and solve the problems between the -th and...
分类:其他好文   时间:2015-08-27 15:23:47    阅读次数:193
2015年多校联合训练第四场(Problem Killer)hdu5328
题意: 求最大等差或等比数列的长度 思路: 开始用二分,WA暴了,后来发现我用的等差数列公式有问题 (a[i]+a[j])*(j-i+1)/2,等差数列一定满足这个公式,但满足这个公式的不一定是等差数列,我sb了。。。。。 还有就算等比数列a[i+1]/a[i] == a[i]/a[i-1],也是sb了,这个会引起精度丢失,应该a[i]^2 = a[i-1]*a[i+1]; ……. 正...
分类:其他好文   时间:2015-07-31 21:58:13    阅读次数:112
hdu5328
题意:求最长的连续的等差 或者 等比序列 思路: 暴力,输入的时候将它们的差和比分别存在两个数组中 ps:此题动不动就超时 很无语, 必须用传统的输入输出, 不能加mem, 如果wrong了 考虑下n==2时答案是否为2; 代码: #include #include #include #include #include #include #include #include ...
分类:其他好文   时间:2015-07-31 10:35:11    阅读次数:131
hdu5328_Problem Killer(简单dp)
今天才知道长度为1或2的数组,既符合等差数列又符合等比数列。。。。dp【0】的初值赋为1,之后其他项赋为2,直接扫一遍,找出最大值就好了还学到了一点:判断等比数列的时候用双精度(double)除法去做,避免数据太大的时候int爆了,这里WA了好久。。。(逃 #include #include #include #include<algorithm...
分类:其他好文   时间:2015-07-30 21:32:20    阅读次数:156
4条  
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!