HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > Array and Matrices > problem:


51069 - Last Digit of a Fibonacci Number

Guest
• Review clarifications (2)

Volume problems

• 50405 - Accounts Receivable
• 50377 - kth Permutation
• 50908 - Buy 1 Get 1
• 50906 - The Smallest Pair
• 51043 - Genome Sequencing
• 51042 - The most frequent k-mer
• 50657 - Permutations and Combinat...
• 51246 - Swap largest word, reverse ...
• 51069 - Last Digit of a Fibonacci...
• 50659 - Covariance Matrix
• 50977 - Gaussian Elimination
• Word Puzzle
• 50748 - Gold Store
• 50658 - The Message
• 50766 - Word Puzzle
• 50934 - Selling Cars
• 50746 - Most Visited

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
Prepared by Arbli Troshani.

Last Digit of a Fibonacci Number

Your goal in this problem is to find the last digit of n-th Fibonacci number. Recall that Fibonacci numbers grow exponentially fast. For example,
  F200 = 280 571 172 992 510 140 037 611 932 413 038 677 189 525

Question:
Given an integer n, find the last digit of the nth Fibonacci number Fn› (that is, Fn mod 10).

Input specification
You will be given a number (n) first where n is between 0 and 107.

Output specification
Show the last digit with the given criteria.

Sample Input I
331
Sample Output I
9

Explanation:
 F331 = 66899.......186469
Note:
A standart algorithm may not work. Slight modification needed!


Для отправки решений необходимо выполнить вход.

www.contester.ru