DCP-389: Fun With Fibonacci Back to All Problems

Beginner Math > Basic Math

The **Fibonacci sequence** is a set of numbers that starts with a ***zero***, followed by a one, and proceeds based on the rule that, each number (*called a Fibonacci number*) is equal to the sum of the preceding two numbers. If the Fibonacci sequence is denoted **F(n)**, where **n** is the term in the sequence, ![enter image description here][1] The **nth** term is defined by recurrence: ***F(n) = F(n-1) + F(n-2). <br>*** And some first numbers are ***0,1,1,2,3,5.. and so on*** Now your task is to find the number of odd and number of even number between a range (*consider 0 as an even number*). Input: ------ First Line of the input contains **T,** representing the number of test case **(1<=T<=50).** For each test case contains two integers **N** and **M . ( 1<=N<=M<=10^18)** and **(|N-M|<=10^5)**.You have to calculate total number of *odd* fibonacci number and total number of *even* fibonacci number between **N'th** fibonacci number and **M'th** fibonacci number . Output: ------- For each test case print case number with the desire answer as show sample output. Sample Input ------------ 2 2 6 1 5 Sample Output ------------- Case 1: Odd = 4 Even = 1 Case 2: Odd = 3 Even = 2 [1]: https://s3-ap-southeast-1.amazonaws.com/devskillimagestorage/questionimages/6683a8d4-6a35-c642-8b88-08d4c89ce819_260c212857cf470ea14bcb00e746a5da_W366xH138.png

Problem Setter:

Razibul Hasan Mithu

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# 2.00
Go 2.00
Java 2.00
JavaScript 2.00
Objective-C 2.00
Perl 2.00
PHP 2.00
Python 2.00
Python3 2.00
Ruby 2.00
VB.Net 2.00

Problem Stats




# User Language Timing
01 aseem_cu Cpp14 0.00s
02 Nazmul_WUB Cpp 0.00s
03 mhiceiuk Cpp 0.00s
04 tariqiitju Cpp 0.00s
05 Nur_Alam39 Cpp 0.00s
06 shekhar_kuet Cpp 0.00s
07 ksohan Cpp 0.00s
08 duronto20 Cpp 0.00s
09 Sakib1061 Cpp 0.00s
10 Arpan_cse_2k14 Cpp 0.00s
11 prodipdatta7 Cpp 0.00s
12 deder Cpp 0.00s
13 rayhan50001 Cpp14 0.00s
14 wizard Cpp 0.00s
15 yasirnabil534 Cpp 0.00s
16 non_coder Cpp 0.00s
17 Anubis Cpp 0.00s
18 mohibur Cpp14 0.00s
19 fayedanik Cpp 0.00s
20 jamil993 Cpp 0.00s
21 bu_hridoy Cpp 0.00s
22 Sajal_Deb Cpp 0.00s
23 Dhrubo020 Cpp 0.00s
24 Ramprosad Cpp 0.00s
25 anik_JU Cpp 0.00s
26 Chayti_Saha98 Cpp14 0.00s
27 Silent_Warrior Cpp 0.00s
28 inam Cpp 0.00s
29 ss1230 Cpp14 0.00s
30 susmoys Cpp 0.00s
31 terminator_c Cpp 0.00s
32 unknown420 Cpp 0.00s
33 Khayrul_34 Cpp14 0.00s
34 Bappy Cpp 0.00s
35 Riad_IIT7 Cpp14 0.00s
36 Himon_PUST Cpp 0.00s
37 anik_ewu Cpp 0.00s
38 Debasish1610177113 C 0.00s
39 mamun02inf Cpp14 0.00s
40 Rakib_RS Cpp 0.00s
41 masiur_hasan Cpp 0.00s
42 Naim_BSMRSTU Cpp 0.00s
43 hmsayem Cpp 0.00s
44 Frdhsn Cpp 0.00s
45 shakil2021 Cpp 0.00s
46 muradhossen Cpp 0.00s
47 milon019 C 0.00s
48 mh755628 Cpp 0.00s
49 shuvo_mbstu Cpp 0.00s
50 Asif_Mohammad Cpp 0.00s

Your feedback is our precious!

Or call +88 02 9853138 for support