Cousin's bread Problem:1142Time Limit:1000msMemory Limit:65535KDescription
The cute cousin encountered a problem, there is a long as N (1≤n≤10^18) of the strip bread, ask can be cut into several paragraphs, so that each piece of bread length is not equal and can not be surrounded by triangles.
Input
The first line is a T (1≤T≤10), which represents the T-group data followed by the T-line, and an integer N (1≤n≤10^18) of each line indicates the length of the loaf
Output
The number of segments the output can be divided into
Sample Input
16
Sample Output
3
Hint
Can be divided into three sections, each length is
Source
The Fibonacci sequence
#include <iostream>#include<stdio.h>using namespacestd;intMain () {inti; Long Longa[ the]; a[1]=1, a[2]=2; for(i=3; i<= -; i++) A[i]=a[i-1]+a[i-2]; for(i=2; i<= -; i++) A[i]=a[i]+a[i-1]; Long Longn,t; scanf ("%lld",&t); while(t--) {scanf ("%lld",&n);//is not equal can not appear two 1 never can not appear not 2 time cannot appear for(i=1; i<= -; i++) { if(a[i]>N) Break; } cout<<i-1<<Endl; } return 0;}
Nefu 1142 Cousin's bread