题目连接: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. SSH整合例子

    三大框架: Struts框架 1. params拦截器: 请求数据封装 2. 类型转换/数据处理 3. struts配置 4. 文件上传/下载/国际化处理 5. 数据效验/拦截器 6. Ognl表达式 ...

  2. 【转】Freemarker输出$和html标签等特殊符号

    原文:http://blog.csdn.net/achilles12345/article/details/41820507 场景:程序员都不喜欢看文档,而更喜欢抄例子.所以,我们把平台组的组件都做成 ...

  3. C primer plus 第五版十二章习题

    看完C prime plus(第五版)第十二章,随带完成了后面的习题. 1.不使用全局变量,重写程序清单12.4的程序. 先贴出12.4的程序,方便对照: /* global.c --- 使用外部变量 ...

  4. linux卸载rpm包

    先查找要卸载的rpm包:比如cpp: #rpm -qa | grep cpp #rpm -e cpp-2.333x.x 如果提示有依赖,执行: #rpm -e cpp-2222 --nodeps

  5. (负)-margin在页面布局中的应用

    有关margin的原理可以看看这篇文章:http://www.cnblogs.com/2050/archive/2012/08/13/2636467.html#2457812 有关margin负值的几 ...

  6. React 相关资料

    learncodeacademy/react-js-tutorials MobX

  7. soj 2543 完全二叉树

    1000. 完全二叉树     Total: 338 Accepted: 81                 Time Limit: 1sec    Memory Limit:256MB Descr ...

  8. Django中的ORM

    Django中ORM的使用. 一.安装python连接mysql的模块:MySQL-python sudo pip install MySQL-python 安装完成后在python-shell中测试 ...

  9. hdu 1022 Train Problem I(栈)

    #include<iostream> #include<vector> #include<cstring> #include<string> #incl ...

  10. linux命令 time

    功能:用于计算命令执行的世界 语法:  time command 例如: hbg@root:~/dl$ time ls111     apple.sh  b.txt            duplic ...