1007,1007 Printer Driver

Source: Internet
Author: User

1007,1007 Printer Driver

Fibonacci count

Time Limit: 1000 MS Memory Limit: 65536 K
Total Submit: 347 Accepted: 248

Description

The infinite series, 21, 34, 55... is called the Fibonacci series, which can be recursively defined
F (n) = 1 ...... (n = 1 or n = 2)
F (n) = F (n-1) + F (n-2)... (n> 2)
I want you to calculate the nth Number of fepona. (1st and the second are both 1)

Input

The first row is an integer m (m <5), indicating a total of m groups of test data.
Each test data has only one row and only one integer n (n <20)

Output

The first row is an integer m (m <5), indicating a total of m groups of test data.
Each test data has only one row and only one integer n (n <20)

Sample Input

3135

Sample Output

125

Source

Typical questions

    using System;    using System.Collections.Generic;    using System.Linq;    using System.Text;    namespace AK1007 {        class Program {            static void Main(string[] args) {                int[] fib = new int[25];                fib[1] = 1; fib[2] = 1;                for (int i = 3; i < 21; i++)                    fib[i] = fib[i - 1] + fib[i - 2];                int n = int.Parse(Console.ReadLine());                while (n-- > 0) {                    int x = int.Parse(Console.ReadLine());                    Console.WriteLine(fib[x]);                }            }        }    }


Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger. Welcome to share your nice codes!

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.