Lyndon's Golf Contest 1 P9 - Fibonacci: The Finale

View as PDF

Submit solution


Points: 0 (partial)
Time limit: 2.0s
Memory limit: 256M

Author:
Problem type
Allowed languages
Python

Your task this time will be on computing Fibonacci numbers. Sounds easy!... or is it?

The Fibonacci numbers are a sequence of numbers generated by taking the sum of the preceding two values. Formally, the sequence is defined as:

f(n)={1if n=11if n=2f(n1)+f(n2)if n3

Given an integer n (1n50), you are to output the nth Fibonacci number.

Note: You may only submit to this problem in Python 3.

Input Specification

The first line of input contains a single integer n.

Output Specification

Output on a single line, the nth Fibonacci number.

Scoring

Your score will be computed based on the length of your source code, the shorter the better. For an L-byte program,

  • if L43, you will receive the full 100 points.
  • if 44L47, you will receive 8010×(L44) points.
  • if 48L, you will receive 20.16(80L) points.

Sample Input

Copy
8

Sample Output

Copy
21

Comments

There are no comments at the moment.