Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
)

func main() {
	sc := bufio.NewScanner(os.Stdin)
	sc.Scan()
	num, _ := strconv.Atoi(sc.Text())

	fmt.Println(fibonacci(num))
}

func fibonacci(num int) int {
	fibs := make([]int, num+1)

	for i := range fibs {
		if i <= 1 {
			fibs[i] = 1
		} else {
			fibs[i] = fibs[i-1] + fibs[i-2]
		}
	}

	return fibs[num]
}

C++: //http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_A
#include <iostream>
using namespace std;

int fibonacci(int n){
    if(n == 0 || n == 1){
        return 1;
    }
    else{
        return fibonacci(n-1)+fibonacci(n-2);
    }
}


int main(){
    int n;
    cin >> n;
    cout << fibonacci(n) << endl;
}

C++: #include <bits/stdc++.h>
using namespace std;
#define lli long long int
#define N 44
lli F[N]={0};

lli fibonacci(int n){
	if(n==0 || n==1)return F[n] = 1;
	if(F[n]!=0)return F[n];
	return F[n] = fibonacci(n-2) + fibonacci(n-1);

}

int main(){
	int n;
	cin >> n;
	cout << fibonacci(n) << endl;
	return 0;
}

C++: #include <cstdio>
#include <iostream>
using namespace std;

#if 0
int Fibonatch(int result[], int num)
{
    int ret = result[num];

    if (ret == 0) {
        if (num > 1) {
            ret = Fibonatch(result, num - 1) + Fibonatch(result, num - 2);
        }
        else {
            ret = 1;
        }
        result[num] = ret;
    }

    return ret;
}

int main(void)
{
    int num;
    int ret[45] = {0};
    int result;

    scanf("%d", &num);
    result = Fibonatch(ret, num);

    printf("%d\n", result);

    return 0;
}
#else

int Fibonatch(int num)
{
    int i;
    int result[45];

    result[0] = result[1] = 0;
    for (i = 2; i <= num; i++) {
        result[i] = result[i - 1] + result[i - 2];
    }

    return result[num];
}

int main(void)
{
    int num;
    int result;

    scnaf("%d", &num);

    result = Fibonatch(num);
    printf("%d\n", result);

    return 0;
}

#endif

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    int a[55];
    a[0]=a[1]=1;
    rep(i,50)a[i+2]=a[i+1]+a[i];
    int n;cin>>n;
    cout<<a[n]<<endl;
    return 0;
}

C++: #include <cstdio>
#include <iostream>
using namespace std;

int Fibonatch(int result[], int num)
{
    int ret = result[num];

    if (ret != 0) {
        if (num > 1) {
            ret = Fibonatch(num - 1) + Fibonatch(num - 2);
        }
        else {
            ret = 1;
        }
        result[num] = ret;
    }

    return ret;
}

int main(void)
{
    int num;
    int ret[45] = {0};

    scanf("%d", &num);
    result = Fibonatch(ret, num);
}

C++: #include<iostream>
#include<cstdio>
#define Lens 50
using namespace std;

int n;
int F[Lens];
int main()
{
	F[0] = F[1] = 1;
	for (int i = 2; i <= Lens; i++)
		F[i] = F[i - 1] + F[i - 2];
	cin >> n;
	cout << F[n];
	return 0;
}

C++: #include <iostream>
using namespace std;

long long int fib(int, long long int*);
int main(){
  int n; cin >> n;
  long long int fibarray[n+1];
  for(int i=0; i<=n; i++) fibarray[i]=-1;
  cout << fib(n, fibarray) << endl;

  return 0;
}

long long int fib(int n, long long int* array){
  if(array[n]>0) return array[n];
  if(n==1 || n==2){
    return array[n]=1;
  }
  else return fib(n-1, array)+fib(n-2, array);
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;


int main(){

    ll F[45];
    F[0]=1; F[1]=1;
    int n;
    cin >> n;
    for(int i=2;i<=n;i++) {
        F[i] = F[i-1] + F[i-2];
    }
    cout << F[n] << endl;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int fib(int n)
{
  static int memos[45];
  if (n < 2) return 1;
  if (memos[n] != 0) return memos[n];
  return memos[n] = fib(n - 1) + fib(n - 2);
}

int main(void)
{
  int n;
  cin >> n;
  cout << fib(n) << endl;
  return 0;
}

C++: #include<stdio.h>

int dp[50];

int fib(int n){
    if(n == 0 || n == 1) return dp[n] = 1;
    if(dp[n] != -1) return dp[n];
    return dp[n] = fib(n-1) + fib(n-2);
}

int main(){
    int n, i;
    for(i=0; i<50; i++) dp[i] = -1;

    scanf("%d", &n);
    printf("%d\n", fib(n));

    return 0;
}

C++: #include <iostream>
using namespace std;
int main(){
    int n;
    cin>>n;
    int fib[50];
    fib[0]=1;fib[1]=1;
    for(int i=2;i<=n;i++)fib[i]=fib[i-1]+fib[i-2];
    cout<<fib[n]<<endl;



return 0;
}

C++: #include<cstdio>

const int MAX_V = 45;
int fib_array[MAX_V]{0};
void make_fib_array(){
  fib_array[0]=1;
  fib_array[1]=1;
  for(int i=2;i<MAX_V;i++)
    fib_array[i]=fib_array[i-1]+fib_array[i-2];
}
int main(){
  make_fib_array();
  int n; scanf("%d",&n);
  printf("%d\n",fib_array[n]);
}

C++: #include<iostream>

using namespace std;

int main (){
  int n;
  cin >>n;
  int F[50];
  F[0] = F[1] = 1;
  for ( int i = 2; i <= n; i++) F[i] = F[i - 1] + F[i - 2];

  cout << F[n] << endl;

  return 0;

}

C++: #include<bits/stdc++.h>
using namespace std;
int memo[64],n;
int f(int n){
  if(~memo[n])return memo[n];
  if(n<=1)return 1;
  return memo[n]=f(n-1)+f(n-2);
}
int main(){
  cin>>n;
  memset(memo,-1,sizeof(memo));
  cout<<f(n)<<endl;
  return 0;
}

C++: #include <cstdio>
using namespace std;

int F[50];

int fibonacci(int n) {
    if (n==0||n==1) {
        return F[n] = 1;
    }
    if (F[n] != -1) {
        return F[n];
    }

    return F[n] = fibonacci(n-1) + fibonacci(n-2);
}
int 
int main (void) {
    int N, i;

    for(i = 0 ; i < 50 ; i ++ ) {
        F[i] = -1;
    }

    scanf("%d", &N);
    printf("%d\n", fibonacci(N));

    return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
    int n;cin>>n;
    int F[50];
    F[0]=F[1]=1;
    for(int i=2;i<=n;i++){
        F[i]=F[i-1]+F[i-2];
    }
    cout<<F[n]<<endl;
}

C++: #include <map>
#include <set>
#include <list>
#include <cmath>
#include <deque>
#include <queue>
#include <stack>
#include <cstdio>
#include <string>
#include <vector>
#include <complex>
#include <cstdlib>
#include <cstring>
#include <numeric>
#include <utility>
#include <iostream>
#include <algorithm>
#include <functional>
#include <unordered_map>
#include <unordered_set>

using namespace std;

#define ll long long
#define ull unsigned long long
#define INF (1 << 30)
#define LLINF (1LL << 62)
#define MOD7 1000000007
#define MOD9 1000000009
#define eps 1e-9
#define P pair<int, int>
#define pii pair<int, int>
#define pll pair<ll, ll>
#define pul pair<ull, ull>
#define all(a) (a).begin(), (a).end()
#define FOR(i,a,b) for (int i=(a);i<(b);++i)
#define RFOR(i,a,b) for (int i=(b)-1;i>=(a);--i)
#define REP(i,n) for (int i=0;i<(n);++i)
#define RREP(i,n) for (int i=(n)-1;i>=0;--i)

void YES() { cout << "YES\n"; }
void NO() { cout << "NO\n"; }
void Yes() { cout << "Yes\n"; }
void No() { cout << "No\n"; }
void yes() { cout << "yes" << endl; }
void no() { cout << "no" << endl; }

template<class T>
T fibonacci(T n) {
	T first = 1, second = 1, ans = 0;
	for (int i = 0; i < n; ++i) {
		if (i > 0) {
			ans += first;
		}
		if (i > 1) {
			ans += second;
			first = second;
			second = ans;
		}
	}
	return ans;
}

int main() {
	int n;
	cin >> n;
	cout << fibonacci(n) << endl;

	return 0;
}

C++: //递归求第n个斐波那契数列
#include<iostream>
using namespace std;

int F[50];
//记忆化递归生成斐波那契数列 
/*int fibonacci(int n)
{
	if(n==1||n==2)
		return F[n]=1;
	if(F[n])
		return F[n];
	else return F[n]=fibonacci(n-1)+fibonacci(n-2);
}*/
//动态规划法生成斐波那契数列
int fibonacci(int n)
{
	if(n==0||n==1)
		F[n]=1;
	for(int i=2;i<n;i++)
	{
		F[i]=F[i-1]+F[i-2];		
	}	
} 
int main()
{
	int n;
	cin>>n;
	int result=fibonacci(n);
	cout<<result<<endl;
	return 0;
}