KK's Steel

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)

Total Submission(s): 109    Accepted Submission(s): 48

Problem Description
Our lovely KK has a difficult mathematical problem:he has a
N(1≤N≤1018)
meters steel,he will cut it into steels as many as possible,and he doesn't want any two of them be the same length or any three of them can form a triangle.
 
Input
The first line of the input file contains an integer
T(1≤T≤10),
which indicates the number of test cases.



Each test case contains one line including a integer
N(1≤N≤1018),indicating
the length of the steel.
 
Output
For each test case, output one line, an integer represent the maxiumum number of steels he can cut it into.
 
Sample Input
1
6
 
Sample Output
3
Hint
1+2+3=6 but 1+2=3 They are all different and cannot make a triangle.
 
Source
 
Recommend
hujie   |   We have carefully selected several similar problems for you:  5624 5623 5622 5621 5619

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
__int64 f[1000];
__int64 n;
int main()
{
int t;
scanf("%d",&t);
f[0]=1;
f[1]=1;
for(int i=2;i<=100;i++)
f[i]=f[i-1]+f[i-2];
while(t--)
{
cin>>n;
__int64 ans=1;
while(n)
{
n-=f[ans];
// printf("%d %d\n",n,f[ans]);
if(n<f[ans+1]) break;
ans++;
}
cout<<ans<<endl;
}
return 0;
}

最新文章

  1. 【转】ORACLE的REDO与UNDO
  2. 在Andoid开发中使用MVP模式来解耦,增加可测试性
  3. Hive:常用的一些命令
  4. Hadoop总结篇之五---模块间是怎么驱动执行的
  5. linux-9基本命令之-查看系统负载 uptime
  6. 黑马程序员——JAVA基础之GUI
  7. 论文笔记之:A CNN Cascade for Landmark Guided Semantic Part Segmentation
  8. Git+Github代码管理控制
  9. 使用WBI SAP Adapter 实现IDoc的同步处理(转)
  10. java_Thread生产者与消费者 Demo
  11. (转载)Java NIO:NIO概述(一)
  12. Android App优化建议(转载)
  13. AngularJS最理想开发工具WebStorm
  14. 从壹开始前后端分离 [ Vue2.0+.NET Core2.1] 二十一║Vue实战:开发环境搭建【详细版】
  15. iOS高德地图让指定区域或者点显示在屏幕中间
  16. Servlet接口UML图
  17. Tex和LaTeX认识
  18. linux文件管理之proc文件系统
  19. .Net Core vs .Net Framework 如何为一个应用程序选择一个运行时(翻译)
  20. jfinal如何查看post还是get请求?

热门文章

  1. 关于php初学者的理解!请大家浏览并指出不足!谢谢!
  2. Jquery隐藏和显示Div的控制
  3. Axure RP 9 WIN10 64位安装步骤及注册码
  4. 【Shell编程】Shell程序设计
  5. C#第八节课
  6. 计蒜客 奇异家庭 (DP)
  7. 日记——OI历程
  8. Linux简单的进度条
  9. Linux浅谈磁盘管理及案例
  10. ScrollReveal-元素随页面滚动产生动画的js插件