Nefu 1142 Cousin's bread

Source: Internet
Author: User

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

Related Keywords:

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.