Hangzhou Electric (HDU) 2070 Fibbonacci number water problem

Source: Internet
Author: User

Fibbonacci numberTime limit:1000/1000 MS (java/others) Memory limit:32768/32768 K (java/others)
Total submission (s): 17675 Accepted Submission (s): 8422


Problem Descriptionyour objective for this question are to develop a program which would generate a Fibbonacci number. The FIBBONACCI function is defined as such:

F (0) = 0
F (1) = 1
F (n) = f (n-1) + f (n-2)

Your program should is able to handle values of N in the range 0 to 50.

Inputeach test case consists of one, integer n in a, where 0≤n≤50. The input is terminated by-1.
Outputprint out the ' answer in a ' for each test case.
Sample Input
345-1

Sample Output
235 This is one of the most basic basics of programming topic, in ACM above the words is water problem, we use the external table method, you can reduce the complexity of time. the code is as follows:


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced. Readers are welcome to comment and correct

Hangzhou Electric (HDU) 2070 Fibbonacci number water problem

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.