hdu 5620 KK's Steel(推理)
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.
#pragma comment(linker, "/STACK:1024000000,1024000000")
#include<iostream>
#include<cstdio>
#include<cstring>
#include<cmath>
#include<math.h>
#include<algorithm>
#include<queue>
#include<set>
#include<bitset>
#include<map>
#include<vector>
#include<stdlib.h>
using namespace std;
#define ll long long
#define eps 1e-10
#define MOD 1000000007
#define N 1000000
#define inf 1e12
ll n;
ll f[N];
void init(){
f[]=;
f[]=;
for(ll i=;i<N;i++){
f[i]=f[i-]+f[i-];
}
}
int main()
{
init();
int t;
scanf("%d",&t);
while(t--){
scanf("%I64d",&n);
ll sum=;
ll i;
for(i=;i<N;i++){
sum+=f[i];
if(sum>n){
break;
}
}
if(n== || n==){
printf("1\n");
continue;
}
printf("%I64d\n",i-);
}
return ;
}
hdu 5620 KK's Steel(推理)的更多相关文章
- HDU 5620 KK's Steel (斐波那契序列)
KK's Steel 题目链接: http://acm.hust.edu.cn/vjudge/contest/121332#problem/J Description Our lovely KK ha ...
- HDU 5620 KK's Steel
想了一下发现是斐波那契数列.....水题 #include <stdio.h> #include <algorithm> #include <string.h> # ...
- 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 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total ...
- hdu 5621 KK's Point(数学,推理题)
题解: 在圆上点三个点时,除圆上三个交点外,圆内没有交点:在圆上点四个点时,除圆上四个交点外,圆内出现了一个交点,因此,在N个点中每四个点便可以在圆内产生一个交点,因此N个点在圆内形成的点的个数为CN ...
- HDU 4869 Turn the pokers(推理)
HDU 4869 Turn the pokers 题目链接 题意:给定n个翻转扑克方式,每次方式相应能够选择当中xi张进行翻转.一共同拥有m张牌.问最后翻转之后的情况数 思路:对于每一些翻转,假设能确 ...
- HDU 4925 Apple Tree(推理)
HDU 4925 Apple Tree 题目链接 题意:给一个m*n矩阵种树,每一个位置能够选择种树或者施肥,假设种上去的位置就不能施肥,假设施肥则能让周围果树产量乘2.问最大收益 思路:推理得到肯定 ...
- HDU 4923 Room and Moor(推理+栈维护)
HDU 4924 Room and Moor 题目链接 题意:给定一个01组成的a序列.要求一个b序列,b序列每一个数值为[0, 1]之间的数,而且b序列为非递减序列,要求∑(ai−bi)2最小,求这 ...
- HDU 5623 KK's Number (博弈DP)
KK's Number 题目链接: http://acm.hust.edu.cn/vjudge/contest/121332#problem/K Description Our lovely KK h ...
随机推荐
- 贝塞尔曲线:原理、自定义贝塞尔曲线View、使用!!!
一.原理 转自:http://www.2cto.com/kf/201401/275838.html Android动画学习Demo(3) 沿着贝塞尔曲线移动的Property Animation Pr ...
- bzoj1644 [Usaco2007 Oct]Obstacle Course 障碍训练课
Description 考虑一个 N x N (1 <= N <= 100)的有1个个方格组成的正方形牧场.有些方格是奶牛们不能踏上的,它们被标记为了'x'.例如下图: . . B x . ...
- (转)ZOJ 3687 The Review Plan I(禁为排列)
The Review Plan I Time Limit: 5 Seconds Memory Limit: 65536 KB Michael takes the Discrete Mathe ...
- canvas动画文字效果
Doughnut Chartvar c=document.getElementById("canvas");var ctx=c.getContext("2d") ...
- sh_脚本语法
介绍: 1 开头 程序必须以下面的行开始(必须方在文件的第一行): #!/bin/sh 符号#!用来告诉系统它后面的参数是用来执行该文件的程序.在这个例子中我们使用/bin/sh来执行程序. 当编写脚 ...
- javax.mail用smtp服务器发送带附件的邮件
jar包: javax.mail-1.5.5.jar maven配置: <dependency> <groupId>com.sun.mail</groupId> & ...
- Linux转发性能评估与优化-转发瓶颈分析与解决方式(补遗)
补遗 关于网络接收的软中断负载均衡,已经有了成熟的方案,可是该方案并不特别适合数据包转发,它对server的小包处理非常好.这就是RPS.我针对RPS做了一个patch.提升了其转发效率. 下面是我转 ...
- 【指数型母函数+非递归快速幂】【HDU2065】"红色病毒"问题
大一上学完数分上后终于可以搞懂指数型母函数了.. 需要一点关于泰勒级数的高数知识 题目在此: "红色病毒"问题 Time Limit: 1000/1000 MS (Java/Oth ...
- MVC学习 (一)
在学习MVC之前对asp.net MVC已经有了一些了解,但是还是有很多的疑问,接下来我慢慢来看书学习并带着问题写博客以作记录. 1.MVC是什么? 2.Asp.net MVC和传统的Asp.net ...
- nth-child和nth-of-type的区别
以前一般都用:nth-child,后来知道了:nth-of-type,然后就一般用nth-of-type 它们两有什么区别呢? 首先来看个现象: 假如有这样一个HTML结构 <div class ...