Go: // AOJ ALDS1_10_A: http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_A

package main

import (
	"fmt"
)

func fibonacci(n int) int64 {
	f := []int64{1, 1}
	for i := 2; i <= n; i++ {
		f = append(f, f[i-2] + f[i-1])
	}
	return f[n]
}

func main() {
	var n int
	fmt.Scanf("%d", &n)
	fmt.Println(fibonacci(n))
}

C++: #include <iostream>
#include <vector>

uint32_t fib(uint32_t n, std::vector<uint32_t>& result) {
  if (n == 0 || n == 1) return 1;
  if (result[n - 1] != 0) return result[n - 1];
  result[n - 1] = fib(n - 1, result) + fib(n - 2, result);
  return result[n - 1];
}

int main() {
  uint32_t n = 0;
  std::cin >> n;

  std::vector<uint32_t> result(n, 0);
  std::cout << fib(n, result) << std::endl;
  return 0;
}

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

typedef long long ll;
typedef pair<int,int> P;

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

C++: #include<bits/stdc++.h>

using namespace std;
#define rep(i,n) for(int i=0;i<(n);i++)

#define MAX 100005
#define INF INT_MAX

typedef long long ll;
typedef pair<int, int> P;

int main(int, char**)
{
    int n;
    cin >> n;

    vector<int> a(n+1);
    rep(i,n+1) {
        if (i <= 1) {
            a[i] = 1;
            continue;
        }
        a[i] = a[i-1] + a[i-2];
    }
    cout << a[n] << endl;
    return 0;
}

C++: #include<iostream>

using namespace std;
int fib(int n);
int main() {
  int n;

  //入力
  cin >> n;

  //出力
  cout << fib(n) << endl;

  return 0;
}

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

C++: #include <stdio.h>

#define N 44

int F[N];
int n;

int  fib(int n){
	if(n==0 || n == 1)
		return 1;

	if(F[n] != 0) return F[n];

	return F[n] = fib(n-1) + fib(n-2);
}

int main(){
	scanf("%d",&n);
	int i;
	for(i=0;i<n;i++){
		F[i] = 0;
	}
	fib(n);
	printf("%d\n",F[n]);
}

C++: #include <iostream>

using namespace std;

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

	cout << n << "\t" << f[n] << endl;
}

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

int A[51];

void func(int n){
  if(n==50) return;
  A[n]=A[n-1]+A[n-2];
  func(n+1);
}

int main(){
  int n;
  cin >> n;
  A[0]=1; A[1]=1;
  func(2);

  cout << A[n] << endl;
}

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

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

C++: #include "bits/stdc++.h"
#include <unordered_set>

#define REP(i, n) for(decltype(n) i = 0; i < (n); i++)
#define REP2(i, x, n) for(decltype(x) i = (x); i < (n); i++)
#define REP3(i, x, n) for(decltype(x) i = (x); i <= (n); i++)
#define RREP(i, n) for (decltype(n) i = (n) - 1;i >= 0; i--)

#define ALL(a) (a).begin(),(a).end()
#define SORT(c) sort((c).begin(),(c).end())
#define DESCSORT(c) sort(c.begin(), c.end(), greater<int>())

#define LL long long int
#define LD long double

#define INF 1000000000
#define PI 3.14159265358979323846

#define _CRT_SECURE_NO_WARNINGS

using namespace std;

// N, E, S, W
const int dx[4] = { -1, 0,  1,  0 };
const int dy[4] = { 0, 1,  0, -1 };

typedef pair<int, int> pii;
typedef pair<LL, LL> pll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<LL> vll;
//==============================================

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);

	int n; cin >> n;
	vi dp{1, 1};

	REP3(i, 2, n) {
		dp.push_back(dp[i - 1] + dp[i - 2]);
	}

	cout << dp[n] << "\n";
	return 0;
}

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

int main(void) {
    cin >> num;
    int array[num] = {};
    array[0] = 1 && array[1] = 1;
    for (int i= 2; i <= num; i++) array[i] = array[i - 1] + array[i - 2];
    cout << array[num] << endl;
}

C++: #include <iostream>

using namespace std;

int ans[45] = {};

int fib(int n) {
	if (n <= 1) return 1;
	int a = ans[n];
	if (a) return a;
	a = fib(n-1) + fib(n-2);
	ans[n] = a;
	return a;
}

int main()
{
	int i = 0;
	cin >> i;
	cout << fib(i) << endl;
}

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

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

int f[45];

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

int main()
{
	int n;
	
	cin >> n;
	for(int i=0;i<=44;i++) f[i]=-1;
	cout << fib(n) << endl;
	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;
	return 0;
}

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

int main(){ 
  int N; cin >> N;

  vector<int> fib(50, 1);
  for(int i=0; i<N-1; i++) fib[i+2] = fib[i+1] + fib[i];

  cout << fib[N] << endl;
}

C++: a

C++: #include <bits/stdc++.h>
using namespace std;
int fib[50] = {1, 1};
int makeFib(int cur) {
    if(fib[cur]) {
        return fib[cur];
    }
    return fib[cur] = makeFib(cur - 1) + makeFib(cur - 2);
}
int main()
{
    for(int i = 2; i < 45; i++) {
        fib[i] = makeFib(i);
    }
    int n;
    cin >> n;
    cout << fib[n] << "\n";
}

C++: #include <iostream>

using namespace std;

int n;
int memo[45];

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

}

int main(void) {
  for (int i = 0; i < 45; i++) { memo[i] = -1; }
  cin >> n;
  cout << fib(n) << endl;
}

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

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

int memo[45] = {0};

int Fibonacci(int n) {
  if(n == 0 || n == 1) return memo[n] = 1;
  if(memo[n] != 0) { // memo[n]????¨??????????
	return memo[n];
  }
  return memo[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;

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;
}

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

int fib(int n){
//  return (n == 0 || n == 1) ? 1 : fib(n - 1) + fib(n - 2);
  int memo[1000] = {1, 1};
  for(auto i = 2; i <= n; i++){
    memo[i] = memo[i - 1] + memo[i - 2];
  }
  return memo[n];
}

int main(){
  int n;
  cin >> n;

  cout << fib(n) << endl;
   return 0;
}

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

int main(){
  int n, fibn[1000];
  fibn[0] = fibn[1] = 1;
  cin >> n;
  for(int i = 2; i <= n;i++)
    fibn[i] = fibn[i-1] + fibn[i-2];
  cout << fibn[n] << endl;
  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;
    
    return 0;
    
}

C++: #include <iostream>

using namespace std;

int fib(int n) {
    int a = 1;
    int b = 1;

    int i = 0;
    while (i < n) {
        int tmp = a;
        a = b;
        b += tmp;
        ++i;
    }
    return a;
}

int main() {
    int n;
    cin >> n;

    cout << fib(n) << endl;

    return 0;
}