You are on page 1of 4

E

COMP6047 – Algorithm and Programming

T
T
NO
BU
FiboCount
Lili just saw a presentation from a lecturer in her class. At the presentation, Lili learned
how to calculate Fibonacci sequences using recursive functions. Lili has a Fibo function to
calculate Fibonacci recursively and she wants to know how many times the Fibo function
is called if Lili calls the Fibo(n) function.

R I
O
Format Input T
The input consists of integer T . The next T line contains an integer n which means the
D

n-th Fibo function that Lili wants to ask.


S
Format Output
The output contains “Case #X: Y ” where X is the testcase number (starting from 1)
DI

and Y is the number of times the Fibo function is called.

Constraints
OT
UT
• 1 ≤ T, n ≤ 30
RE

Sample Input 1 (standard input)


1
2
N
IB
Sample Output 1 (standard output)
TR
Case #1: 3
DO

Sample Input 2 (standard input)


1
15
IS
ED

© School of Computer Science - BINUS, 2021. No part of the materials available may be copied,
photocopied, reproduced, translated, or reduced to any electronic medium or machine-readable form,
in whole or in part, without prior written consent of School of Computer Science - BINUS. Any other
reproduction in any form without the permission of School of Computer Science - BINUS is probihited.
Violators of this clause may be academically sanctioned.
E
COMP6047 – Algorithm and Programming

T
T
Sample Output 2 (standard output)

NO
BU
Case #1: 1973

R I
O
T
D
S
DI

OT
UT
RE

N
IB
TR
DO
IS
ED

© School of Computer Science - BINUS, 2021. No part of the materials available may be copied,
photocopied, reproduced, translated, or reduced to any electronic medium or machine-readable form,
in whole or in part, without prior written consent of School of Computer Science - BINUS. Any other
reproduction in any form without the permission of School of Computer Science - BINUS is probihited.
Violators of this clause may be academically sanctioned.
E
COMP6047 – Algorithm and Programming

T
T
NO
BU
FiboCount
Lili baru saja melihat presentasi dari dosen dikelasnya. Pada presentasi tersebut, Lili
belajar cara menghitung deret Fibonacci dengan menggunakan fungsi rekursif. Lili
memiliki sebuah fungsi Fibo untuk menghitung Fibonacci secara rekursif dan Ia ingin
tahu berapa kali fungsi Fibo dipanggil jika Lili memanggil fungsi Fibo(n).

R I
O
Format Input T
Input terdiri dari bilangan bulat T . T baris berikutnya berisi sebuah integer n yang
D

berarti fungsi Fibo ke-n yang ingin ditanya Lili.


S
Format Output
Output berisi “Case #X: Y ” dimana X merupakan nomor testcase (mulai dari 1) dan
DI

Y merupakan jumlah berapa kali fungsi Fibo dipanggil.

Constraints
OT
UT
• 1 ≤ T, n ≤ 30
RE

Sample Input 1 (standard input)


1
2
N
IB
Sample Output 1 (standard output)
TR
Case #1: 3
DO

Sample Input 2 (standard input)


1
15
IS
ED

© School of Computer Science - BINUS, 2021. No part of the materials available may be copied,
photocopied, reproduced, translated, or reduced to any electronic medium or machine-readable form,
in whole or in part, without prior written consent of School of Computer Science - BINUS. Any other
reproduction in any form without the permission of School of Computer Science - BINUS is probihited.
Violators of this clause may be academically sanctioned.
E
COMP6047 – Algorithm and Programming

T
T
Sample Output 2 (standard output)

NO
BU
Case #1: 1973

R I
O
T
D
S
DI

OT
UT
RE

N
IB
TR
DO
IS
ED

© School of Computer Science - BINUS, 2021. No part of the materials available may be copied,
photocopied, reproduced, translated, or reduced to any electronic medium or machine-readable form,
in whole or in part, without prior written consent of School of Computer Science - BINUS. Any other
reproduction in any form without the permission of School of Computer Science - BINUS is probihited.
Violators of this clause may be academically sanctioned.

You might also like