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

194/773

Solve/Submission

Ranking

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

Your feedback is our precious!



Or call +88 02 9853138 for support