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>

using lli = long long int;
std::vector<lli> vec;
int main() {
    int n;
    std::cin >> n;
    vec.assign(n+1, 0);
    vec[0] = 1;
    vec[1] = 1;
    for (int i = 2; i <= n; i++) {
        vec[i] = vec[i-1] + vec[i-2];
    }
    std::cout << vec[n] << std::endl;

}

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

int main() {
	int n; cin >> n;
	vector<int> F(50, 0);

	F[0] = 1;
	for (int i = 0; i < n; ++i) {
		F[i + 1] += F[i];
		F[i + 2] += F[i];
	}

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

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

int f[45];
int n;

int fibonacci(int n){
	
	cin >> n;
	f[0]=f[1]=1;

	for(int i=2;i<=n;i++){
		f[i]=f[i-1]+f[i-2];
	}
	return f[n];
}


int main(){
	cout << fibonacci(n) << "\n";
    return 0;
}

C++: #include <iostream>
using ll = long long;
using namespace std;
#define MAX 50
/* initialize */
int fibs[MAX];

/* main */
int main() {

    int n;
    cin >> n;
    fibs[0]=fibs[1] = 1;
    for (int i = 2; i <= n; i++) {
        fibs[i] = fibs[i-1] + fibs[i-2];
    }
    cout << fibs[n] << "\n";
    return 0;
}

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

// // TLEとなってしまう実装
// int fib(int n)
// {
//   // ベースケース
//   if (n == 0)
//   {
//     return 1;
//   }
//   if (n == 1)
//   {
//     return 1;
//   }
//   // 再帰ステップ
//   return fib(n - 1) + fib(n - 2);
// }

vector<int> F(100, 0);

int fib(int n)
{
  // n項目を計算済みのとき
  if (F.at(n) > 0)
  {
    return F.at(n);
  }
  // n項目を未計算のとき
  if (n == 0 || n == 1)
  {
    F.at(n) = 1;
  }
  else
  {
    F.at(n) = fib(n - 1) + fib(n - 2);
  }
  return F.at(n);
}

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

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

int F[SIZE];

int Fibonacci(int n)
{
    if (n == 1 || n == 0)
    {
        return F[n] = 1;
    }
    if (F[n])
    {
        return F[n];
    }
    return F[n] = Fibonacci(n - 1) + Fibonacci(n - 2);
}

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

    return 0;
}

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

int main()
{
	int n,x1=1,x2=1,tmp=0;
	cin >> n;
	
	if(n==0||n==1) cout << "1";
	else{
		for(;n>2;n--){
			tmp=x1+x2;
			x1=x2;
			x2=tmp;
		}
	}
	cout << x1 + x2;
}

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

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

	int ans = 1;
	if( n == 0 || n == 1 ) {
	}
	else {
		vector<int> dp( n + 1 );
		dp[0] = 1;
		dp[1] = 1;
		for( int i = 2; i < n + 1; i++ ) {
			dp[i] = dp[i - 1] + dp[i - 2];
		}
		ans = dp[n];
	}

	cout << ans << endl;
}

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

void fnInput(vector<int>& rvnFibDP)
{
  int nMaxSiz;
  cin >> nMaxSiz;
  rvnFibDP.resize(nMaxSiz + 1, 0);

  if (nMaxSiz >= 1)  
    rvnFibDP[0] = rvnFibDP[1] = 1;
  else
    rvnFibDP[0] = 1;
}

int fnFibNumber(vector<int>& rvnFibDP, int nNo)
{
  if (rvnFibDP[nNo])  return rvnFibDP[nNo];

  return rvnFibDP[nNo] = 
         fnFibNumber(rvnFibDP, nNo - 1) + fnFibNumber(rvnFibDP, nNo - 2);
}

int main()
{
  cin.tie(0);
  ios::sync_with_stdio(false);
  vector<int> vnFibDP; 

  fnInput(vnFibDP);
  cout << fnFibNumber(vnFibDP, vnFibDP.size() - 1) << endl;
  return 0;
}

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

using namespace std;


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

    vector<int> dp(n+1, 0);

    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 <iostream>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
#include <iomanip>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <map>
#include <deque>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <list>
#include <unordered_map>



using namespace std;

int main() {
   

    long long n;
    cin >> n;
    long long 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 <iostream>
using namespace std;

unsigned long long ull[45];

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