codeforces-scrape

Codeforces scraped problems and editorials
git clone git://git.laack.co/codeforces-scrape.git
Log | Files | Refs | README

72G.md (774B)


      1 Source: https://codeforces.com/problemset/problem/72/G
      2 
      3 G. Fibonacci army
      4 
      5 time limit per test
      6 
      7 2 seconds
      8 
      9 memory limit per test
     10 
     11 256 megabytes
     12 
     13 input
     14 
     15 stdin
     16 
     17 output
     18 
     19 stdout
     20 
     21 King Cambyses loves Fibonacci numbers. He has several armies. Today he wants to make a new army for himself and he wants the number of men in this army to be the *n*-th Fibonacci number.
     22 
     23 Given *n* you should find *n*-th Fibonacci number. The set of Fibonacci numbers start with *f*0 = *f*1 = 1 and for each *i* ≥ 2, *f**i* = *f**i* - 1 + *f**i* - 2.
     24 
     25 Input
     26 
     27 Input contains a single integer *n* (1 ≤ *n* ≤ 20).
     28 
     29 Output
     30 
     31 Write a single integer. The *n*-th Fibonacci number.
     32 
     33 Examples
     34 
     35 Input
     36 
     37 ```
     38 2
     39 ```
     40 
     41 Output
     42 
     43 ```
     44 2
     45 ```
     46 
     47 Input
     48 
     49 ```
     50 1
     51 ```
     52 
     53 Output
     54 
     55 ```
     56 1
     57 ```