DCP-138: The Last Fibonacci Back to All Problems

Medium Math > Number Theory


Fabliha and Oishy are playing a game called " Finding Fibonacci Digit " . As they are very fond of Fibonacci numbers, they are trying to find how fast one can guess the last digit of n-th Fibonacci number. Can you do the same as fast as them ? Fibonacci numbers are : 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, ....... starting from 0-th Fibonacci numbers. We see that Fibonacci of n-th = Fibonacci of (n-1)th + Fibonacci of (n-2)th , here n starts from ZERO. Input: ------ Input starts with an integer T (1<=20), denoting the number of test cases. Each case contains an integer N (0 ≤ N ≤ 10^9) denoting the N-th Fibonacci number. Your task is to find the last digit of N-th Fibonacci number. For N = 5, the output should be 5. Output: ------- Print the last digit of N-th Fibonacci number in a line. See output format for details. Sample Input ------------ 2 5 7 Sample Output ------------- Case 1: 5 is the last digit. Case 2: 3 is the last digit.


Problem Setter:

Sifat Siddiqi Shishir

Please login to submit solution to this problem.

Problem Limits

Language Time Limit (seconds)
C 1.00
C++ 1.00
C++14 1.00
C# 3.00
Go 3.00
Java 3.00
JavaScript 3.00
Objective-C 3.00
Perl 3.00
PHP 3.00
Python 3.00
Python3 3.00
Ruby 3.00
VB.Net 3.00

Problem Stats

199/795

Solve/Submission

Ranking

# User Language Timing
01 sakib_muhit Cpp14 0.00s
02 AlaminJust Cpp14 0.00s
03 ash12 Cpp14 0.00s
04 seyedssz Cpp14 0.00s
05 MAHRahat Cpp14 0.00s
06 terminator_c Cpp14 0.00s
07 sadia2427 Cpp14 0.00s
08 Nazmul_WUB Cpp14 0.00s
09 hmtanbir Cpp14 0.00s
10 jualahmed Cpp14 0.00s
11 Rakib05 C 0.00s
12 kpretomazi Cpp 0.00s
13 mahmud2690 Cpp 0.00s
14 hamedomarkhaled Cpp 0.00s
15 abdulmukit Cpp 0.00s
16 wayne6172 C 0.00s
17 Robbinb1993 Cpp 0.00s
18 marineCoder Cpp 0.00s
19 prodipdatta7 Cpp14 0.00s
20 Morass Cpp14 0.00s
21 Frdhsn Cpp14 0.00s
22 Ruhul1975 Cpp 0.00s
23 rashedul007 C 0.00s
24 rockersabbir Cpp 0.00s
25 saeefad Cpp 0.00s
26 Turin Cpp 0.00s
27 purple Cpp 0.01s
28 rabbicse Cpp 0.01s
29 Lion_roar Cpp 0.01s
30 RandyWaterhouse Cpp 0.01s
31 joymollick Cpp14 0.01s
32 shishir09 Cpp14 0.01s
33 JubayerSohel Cpp14 0.01s
34 deder Cpp14 0.01s
35 onucsecu Cpp14 0.01s
36 Dinar Cpp14 0.01s
37 smriad Cpp14 0.01s
38 ammasum Cpp14 0.01s
39 feodorv C 0.01s
40 rabel Cpp14 0.01s
41 _dipu Cpp14 0.01s
42 nazmul_bzs Cpp14 0.01s
43 FariD Cpp 0.01s
44 SakibAlamin Cpp14 0.01s
45 jim1 Cpp14 0.01s
46 joy25896 Cpp14 0.01s
47 Ishrak Cpp14 0.07s
48 haasib Cpp14 0.07s
49 anis Cpp14 0.07s
50 robin_aust Cpp14 0.07s
Feedback

Your feedback is our precious!



Or call +88 02 9853138 for support