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 Misu_Dey Cpp 0.00s
02 bu_hridoy Cpp 0.00s
03 Arpan_cse_2k14 Cpp 0.00s
04 rayhan50001 Cpp14 0.00s
05 milon019 C 0.00s
06 mh755628 Cpp 0.00s
07 Frdhsn Cpp 0.00s
08 Asif_Mohammad Cpp 0.00s
09 susmoys Cpp 0.00s
10 inam Cpp 0.00s
11 Riad_IIT7 Cpp14 0.00s
12 Khayrul_34 Cpp14 0.00s
13 Sajal_Deb Cpp 0.00s
14 deder Cpp 0.00s
15 muradhossen Cpp 0.00s
16 duronto20 Cpp 0.00s
17 Naim_BSMRSTU Cpp 0.00s
18 Anubis Cpp 0.00s
19 prodipdatta7 Cpp 0.00s
20 shekhar_kuet Cpp 0.00s
21 Sakib1061 Cpp 0.00s
22 Bappy Cpp 0.00s
23 yasirnabil534 Cpp 0.00s
24 Himon_PUST Cpp 0.00s
25 Shadin Cpp14 0.00s
26 Ramprosad Cpp 0.00s
27 Dhrubo020 Cpp 0.00s
28 factoradic Cpp 0.00s
29 Debasish1610177113 C 0.00s
30 aseem_cu Cpp14 0.00s
31 anik_ewu Cpp 0.00s
32 non_coder Cpp 0.00s
33 shakil2021 Cpp 0.00s
34 unknown420 Cpp 0.00s
35 anik_JU Cpp 0.00s
36 SAIF_IIT8_JU Cpp 0.00s
37 Riz1ahmed Cpp 0.00s
38 ksohan Cpp 0.00s
39 ikaadil Cpp 0.00s
40 Chayti_Saha98 Cpp14 0.00s
41 tariqiitju Cpp 0.00s
42 Nur_Alam39 Cpp 0.00s
43 Zihad C 0.00s
44 mamun02inf Cpp14 0.00s
45 mohibur Cpp14 0.00s
46 sraman915 Cpp 0.00s
47 mhiceiuk Cpp 0.00s
48 ss1230 Cpp14 0.00s
49 Rakib_RS Cpp 0.00s
50 Silent_Warrior Cpp 0.00s

Your feedback is our precious!

Or call +88 02 9853138 for support