-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b91739c
commit a7770c5
Showing
5 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import sys | ||
|
||
memoized_fibonacci = [0] * 41 | ||
|
||
|
||
def fibonacci(n): | ||
global memoized_fibonacci | ||
|
||
if memoized_fibonacci[n] != 0: | ||
return memoized_fibonacci[n] | ||
|
||
if n in (1, 2): | ||
memoized_fibonacci[n] = 1 | ||
else: | ||
memoized_fibonacci[n] = fibonacci(n - 1) + fibonacci(n - 2) | ||
|
||
return memoized_fibonacci[n] | ||
|
||
|
||
for line in sys.stdin: | ||
for i in range(int(line), 0, -1): | ||
print(str(fibonacci(i)), end='') | ||
if i == 1: | ||
print() | ||
else: | ||
print(' ', end='') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
1 | ||
2 | ||
3 | ||
4 | ||
5 | ||
6 | ||
7 | ||
8 | ||
9 | ||
10 | ||
11 | ||
12 | ||
13 | ||
14 | ||
15 | ||
16 | ||
17 | ||
18 | ||
19 | ||
20 | ||
21 | ||
22 | ||
23 | ||
24 | ||
25 | ||
26 | ||
27 | ||
28 | ||
29 | ||
30 | ||
31 | ||
32 | ||
33 | ||
34 | ||
35 | ||
36 | ||
37 | ||
38 | ||
39 | ||
40 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
1 | ||
1 1 | ||
2 1 1 | ||
3 2 1 1 | ||
5 3 2 1 1 | ||
8 5 3 2 1 1 | ||
13 8 5 3 2 1 1 | ||
21 13 8 5 3 2 1 1 | ||
34 21 13 8 5 3 2 1 1 | ||
55 34 21 13 8 5 3 2 1 1 | ||
89 55 34 21 13 8 5 3 2 1 1 | ||
144 89 55 34 21 13 8 5 3 2 1 1 | ||
233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
6765 4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
10946 6765 4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
17711 10946 6765 4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
28657 17711 10946 6765 4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
46368 28657 17711 10946 6765 4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
75025 46368 28657 17711 10946 6765 4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
121393 75025 46368 28657 17711 10946 6765 4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
196418 121393 75025 46368 28657 17711 10946 6765 4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
317811 196418 121393 75025 46368 28657 17711 10946 6765 4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
514229 317811 196418 121393 75025 46368 28657 17711 10946 6765 4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
832040 514229 317811 196418 121393 75025 46368 28657 17711 10946 6765 4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
1346269 832040 514229 317811 196418 121393 75025 46368 28657 17711 10946 6765 4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
2178309 1346269 832040 514229 317811 196418 121393 75025 46368 28657 17711 10946 6765 4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
3524578 2178309 1346269 832040 514229 317811 196418 121393 75025 46368 28657 17711 10946 6765 4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
5702887 3524578 2178309 1346269 832040 514229 317811 196418 121393 75025 46368 28657 17711 10946 6765 4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
9227465 5702887 3524578 2178309 1346269 832040 514229 317811 196418 121393 75025 46368 28657 17711 10946 6765 4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
14930352 9227465 5702887 3524578 2178309 1346269 832040 514229 317811 196418 121393 75025 46368 28657 17711 10946 6765 4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
24157817 14930352 9227465 5702887 3524578 2178309 1346269 832040 514229 317811 196418 121393 75025 46368 28657 17711 10946 6765 4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
39088169 24157817 14930352 9227465 5702887 3524578 2178309 1346269 832040 514229 317811 196418 121393 75025 46368 28657 17711 10946 6765 4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
63245986 39088169 24157817 14930352 9227465 5702887 3524578 2178309 1346269 832040 514229 317811 196418 121393 75025 46368 28657 17711 10946 6765 4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 | ||
102334155 63245986 39088169 24157817 14930352 9227465 5702887 3524578 2178309 1346269 832040 514229 317811 196418 121393 75025 46368 28657 17711 10946 6765 4181 2584 1597 987 610 377 233 144 89 55 34 21 13 8 5 3 2 1 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
https://judge.beecrowd.com/en/problems/view/2807 | ||
|
||
# Iccanobif | ||
|
||
Iccanobif sequences are sequences where each term is always equal to the sum of | ||
the next two subsequent to it. Except for the last two terms which are always | ||
equal to 1 | ||
|
||
Example of an Iccanobif sequence with 10 terms: 55, 34, 21, 13, 8, 5, 3, 2, 1, | ||
1. | ||
|
||
Your task is, given an integer value, print the corresponding size Iccanobif | ||
sequence. | ||
|
||
## Input | ||
|
||
The entry consists of a single integer $N (1 \leq N \leq 40)$ representing the | ||
size of the desired Iccanobif sequence. | ||
|
||
## Output | ||
|
||
The output consists of a single line containing the terms of the Iccanobif | ||
sequence of $N$ size separated by a single space. | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
beginner |