题目连接:http://acm.hdu.edu.cn/showproblem.php?pid=5620

题意:给你一个n长的钢管,要分的尽可能多,且任意三条不能构成三角形

题解:看hint就知道用递推来解

 #include<cstdio>
#define F(i,a,b) for(int i=a;i<=b;++i) long long a[],b[],n;int t,l,r,mid; int main(){
b[]=,b[]=,a[]=b[];
F(i,,)b[i]=b[i-]+b[i-];
F(i,,)a[i]+=a[i-]+b[i];
scanf("%d",&t);
while(t--){
scanf("%lld",&n);
for(l=,r=;l<=r;)if(a[mid=l+((r-l)>>)]>n)r=mid-;else l=mid+;
printf("%d\n",l-);
}
return ;
}

hdu_5620_KK's Steel(水题)的更多相关文章

  1. HDOJ 2317. Nasty Hacks 模拟水题

    Nasty Hacks Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others) Tota ...

  2. ACM :漫漫上学路 -DP -水题

    CSU 1772 漫漫上学路 Time Limit: 1000MS   Memory Limit: 131072KB   64bit IO Format: %lld & %llu Submit ...

  3. ytu 1050:写一个函数,使给定的一个二维数组(3×3)转置,即行列互换(水题)

    1050: 写一个函数,使给定的一个二维数组(3×3)转置,即行列互换 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 154  Solved: 112[ ...

  4. [poj2247] Humble Numbers (DP水题)

    DP 水题 Description A number whose only prime factors are 2,3,5 or 7 is called a humble number. The se ...

  5. gdutcode 1195: 相信我这是水题 GDUT中有个风云人物pigofzhou,是冰点奇迹队的主代码手,

    1195: 相信我这是水题 Time Limit: 1 Sec  Memory Limit: 128 MBSubmit: 821  Solved: 219 Description GDUT中有个风云人 ...

  6. BZOJ 1303 CQOI2009 中位数图 水题

    1303: [CQOI2009]中位数图 Time Limit: 1 Sec  Memory Limit: 162 MBSubmit: 2340  Solved: 1464[Submit][Statu ...

  7. 第十一届“蓝狐网络杯”湖南省大学生计算机程序设计竞赛 B - 大还是小? 字符串水题

    B - 大还是小? Time Limit:5000MS     Memory Limit:65535KB     64bit IO Format: Description 输入两个实数,判断第一个数大 ...

  8. ACM水题

    ACM小白...非常费劲儿的学习中,我觉得目前我能做出来的都可以划分在水题的范围中...不断做,不断总结,随时更新 POJ: 1004 Financial Management 求平均值 杭电OJ: ...

  9. CF451C Predict Outcome of the Game 水题

    Codeforces Round #258 (Div. 2) Predict Outcome of the Game C. Predict Outcome of the Game time limit ...

随机推荐

  1. C++ 简史

    Bjarne Stroustrup 这哥们在剑桥读博的时候,需要实现一个分布式的操作系统.仔细一想,自己在丹麦读大学的时候就用过 Simula,记得它的「类型表达」.「编译排错」能力以及「类」和「协程 ...

  2. Webbench源代码分析(转载)

    转载地址 http://blog.csdn.net/kangroger/article/details/42500703 Web Bench是一个网站压力测试的工具.其最后更新时间是2004年,已经十 ...

  3. linux下安装nginx+php

    参考:http://blog.csdn.net/ihelloworld/article/details/7029796 http://blog.chinaunix.net/uid-21374062-i ...

  4. MD5 .net与PHP加密值一样的加密代码

    .net 代码 using System.Security.Cryptography; /// <summary> /// 返回大写形式的MD5加密 /// </summary> ...

  5. CSU 1640 机智的刷题方式

    完全背包 #include<cstdio> #include<cstring> #include<cmath> #include<algorithm> ...

  6. Distributing Parts

    Distributing Parts 题目链接:http://codeforces.com/problemset/problem/496/E 贪心 将音乐和人都以低音升序排序,贪心处理低音更低的音乐, ...

  7. C#_FindWindow

    using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; usin ...

  8. hdu_5908_Abelian Period(暴力)

    题目链接:hdu_5908_Abelian Period 题意: 给你n个数字,让你找出所有的k,使得把这n个数字分为k分,并且每份的数字种类和个数必须相同 题解: 枚举k,首先k必须是n的约数,然后 ...

  9. 禁止使用test类的就是禁止使用本来的$this对象.可以调用父类的对象

    public function __construct() { parent::__construct( ); parent::__construct( ); if(!APP_DEBUG ) die( ...

  10. lua 中 IO库

    read函数从当前输入文件读取串,由它的参数控制读取的内容: "*all”             读取整个文件 "*line"            读取下一行 &qu ...