hdu 5620
KK's Steel
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)
Total Submission(s): 197 Accepted Submission(s): 90
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.
, 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.
6
1+2+3=6 but 1+2=3 They are all different and cannot make a triangle.
#include<iostream>
#include<cstdio>
#define LL __int64
using namespace std;
int main()
{
int t;
LL n;
scanf("%d",&t);
for(int i=1;i<=t;i++)
{
scanf("%I64d",&n);
LL exm=1;
LL ans=0;
LL flag=1;
while(n>=exm)
{
LL gg;
gg=exm;
ans++;
n-=exm;
exm+=flag;
flag=gg;
//cout<<flag<<" "<<exm<<endl;
}
printf("%I64d\n",ans);
}
return 0;
}
hdu 5620的更多相关文章
- HDU 5620 KK's Steel (斐波那契序列)
KK's Steel 题目链接: http://acm.hust.edu.cn/vjudge/contest/121332#problem/J Description Our lovely KK ha ...
- BestCoder Round #71 (div.2) (hdu 5620 菲波那切数列变形)
KK's Steel Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total ...
- hdu 5620 KK's Steel(推理)
Problem Description Our lovely KK has a difficult mathematical problem:he has a N(1≤N≤1018) meters s ...
- HDU 5620 KK's Steel
想了一下发现是斐波那契数列.....水题 #include <stdio.h> #include <algorithm> #include <string.h> # ...
- HDOJ 2111. Saving HDU 贪心 结构体排序
Saving HDU Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total ...
- 【HDU 3037】Saving Beans Lucas定理模板
http://acm.hdu.edu.cn/showproblem.php?pid=3037 Lucas定理模板. 现在才写,noip滚粗前兆QAQ #include<cstdio> #i ...
- hdu 4859 海岸线 Bestcoder Round 1
http://acm.hdu.edu.cn/showproblem.php?pid=4859 题目大意: 在一个矩形周围都是海,这个矩形中有陆地,深海和浅海.浅海是可以填成陆地的. 求最多有多少条方格 ...
- HDU 4569 Special equations(取模)
Special equations Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u S ...
- HDU 4006The kth great number(K大数 +小顶堆)
The kth great number Time Limit:1000MS Memory Limit:65768KB 64bit IO Format:%I64d & %I64 ...
随机推荐
- 为什么Python在列表和元组的末尾允许使用逗号?
Python 允许您在列表,元组和字典的末尾添加一个尾随逗号: [1, 2, 3,] ('a', 'b', 'c',) d = { "A": [1, 5], "B&quo ...
- Mongo DB Java操作
1.首先下载Mongo DB java 驱动 2.操作Mongo 增删改查 package com.sjjy.mongo; import java.util.ArrayList;import java ...
- 使用清华镜像在python中pip 安装
Anaconda的安装步骤不在本文的讨论中,我们主要是学习一下如何配置conda的镜像,以及一些问题的解决过程 配置镜像 在conda安装好之后,默认的镜像是官方的,由于官网的镜像在境外,我们使用国内 ...
- error:no module named StringIO or cStringIO
一般遇到没有某个模块问题的时候,通常的解决方法是pip相应的模块: 不过,鉴于Python2和python3的不同(让人头疼) 解决方法:在python3中,该模块被新的模块取代,即io. 重新imp ...
- 统计学习五:3.决策树的学习之CART算法
全文引用自<统计学习方法>(李航) 分类与回归树(classification and regression tree, CART)模型是由Breiman等人于1984年提出的另一类决策树 ...
- dice2win
触发交易 转0个 https://etherscan.io/tx/0x784e80167353a886183106cbe3bd15e614cafdb5d6885ccd101177aa0f937a36 ...
- C语言struct中的长度可变数组(Flexible array member)
C_struct中的长度可变数组(Flexible array member) Flexible array member is a feature introduced in the C99 sta ...
- HDU 2491 Priest John's Busiest Day(贪心)(2008 Asia Regional Beijing)
Description John is the only priest in his town. October 26th is the John's busiest day in a year be ...
- DFS中的奇偶剪枝(技巧)
剪枝是什么,简单的说就是把不可行的一些情况剪掉,例如走迷宫时运用回溯法,遇到死胡同时回溯,造成程序运行时间长.剪枝的概念,其实就跟走迷宫避开死胡同差不多.若我们把搜索的过程看成是对一棵树的遍历,那么剪 ...
- TCP系列05—连接管理—4、TCP连接的ISN、连接建立超时及TCP的长短连接
一.TCP连接的ISN 之前我们说过初始建立TCP连接的时候的系列号(ISN)是随机选择的,那么这个系列号为什么不采用一个固定的值呢?主要有两方面的原因 防止同一个连接的不同实例(di ...