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<bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
typedef pair<ll, ll> PLL;
typedef vector<int> VI;
typedef vector<char> VC;
typedef vector<double> VD;
typedef vector<string> VS;
typedef vector<ll> VLL;
typedef vector<PLL> VP;
const static int INF = 1000000000;
const static int MOD = 1000000007;
const int dx[4]={1, 0, -1, 0};
const int dy[4]={0, 1, 0, -1};
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
#define rep(i,n) for (ll i=0; i<(ll)(n); i++)
#define repd(i,n) for (ll i=n-1; i>=0; i--)
#define rept(i,m,n) for(ll i=m; i<n; i++)
#define stl_rep(itr, x) for (auto itr = x.begin(); itr != x.end(); ++itr)
#define all(x) (x).begin(), (x).end()
#define F first
#define S second
#define PF push_front
#define PB push_back
#define SORT(V) sort((V).begin(), (V).end())
#define RVERSE(V) reverse((V).begin(), (V).end())
#define paired make_pair
#define PRINT(V) for(auto v : (V)) cout << v << " "
//charを整数に
int ctoi(char c) { if (c >= '0' && c <= '9') { return c - '0'; } return 0; }
// 累積和 for (int i = 0; i < N; ++i) s[i+1] = s[i] + a[i]; 
void cum_sum(int N,vector<double> a, vector<double> &s){ for(int i=0; i<N; i++){ s[i+1]=s[i]+a[i];}}
//ユークリッドの控除法
ll gcd(ll a,ll b){
    if(b == 0) return a;
    return gcd(b,a%b);
}
//最小公倍数
ll lcm(ll a,ll b){
    ll g = gcd(a,b);
    return a / g * b; // Be careful not to overflow
}
//素数判定
bool is_prime(long long n) {
    if (n <= 1) return false;
    for (long long p = 2; p * p <= n; ++p) {
        if (n % p == 0) return false;
    }
    return true;
}
int getdigit(ll num){
    unsigned digit=0;
    while(num!=0){
        num /= 10;
        digit++;
    }
    return digit;
}
//空白文字も入力 getline(cin, S);
//桁数指定 setprecision

int main()
{
    ios::sync_with_stdio(0); 
    cin.tie(0); 
    cout.tie(0);
    int n;
    cin >> n;
    vector<int> dp(45);
    for(int i=0; i<45; i++){
        if(i==0 || i==1){
            dp[i]=1;
        }
        else{
            dp[i]=dp[i-1]+dp[i-2];
        }
    }
    cout << dp[n] << endl;
}

C++: /*
　　　∫ ∫ ∫
　　　ノヽ
　　（＿　 ）
　（＿　　　 ）
（＿＿＿＿＿＿ ）
　ヽ(´･ω･)ﾉ　
　　 |　 /
　　 UU
*/
#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
using P = pair<ll, ll>;
const int MOD = (int)1e9 + 7;
const ll INF = 1LL << 60;
const int inf = 1<<30;
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a=b; return 1; } return 0; }
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i,s,n) for (int i = s; i < (n); i++)
#define ALL(obj) (obj).begin(), (obj).end() //コンテナじゃないと使えない!!
#define debug(x) cerr << #x << ": " << x << "\n";
#define mp make_pair
template <typename T>
ostream& operator<<(ostream& os, vector<T> &V){
    int N = V.size();
    REP(i,N){
        os << V[i];
        if (i!=N-1) os << " ";
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, pair<T,T> const&P){
    os << P.first;
    os << " ";
    os << P.second;
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T> &S){
    auto it=S.begin();
    while(it!=S.end()){
        os << *it;
        os << " ";
        it++;
    }
    os << "\n";
    return os;
}
template <typename T>
ostream& operator<<(ostream& os, deque<T> &q){
    for(auto it=q.begin();it<q.end();it++){
        os<<*it;
        os<<" ";
    }
     os<<endl;
    return os;
}
//fixed<<setprecision(10)<<ans<<endl;
int main(){
    cin.tie(0);
    ios::sync_with_stdio(false);
    int N;
    cin >> N;
    int fib[N+1];
    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;
}

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

int F[100];
int main()
{
    int N;
    cin >> N;
    F[0]=1;
    F[1]=1;
    for(int i=2;i<=N;i++)
       F[i]=F[i-2]+F[i-1];
    cout << F[N] << endl;
}

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

void solve(){
  int n; cin >> n;
  vector<int> f(n + 1);
  f[0] = 1;
  f[1] = 1;
  if(n <= 1){
    cout << f[n] << endl;
    return;
  }
  for(int i = 2; i <= n; i++){
    f[i] = f[i - 1] + f[i - 2];
  }
  cout << f[n] << endl;
  return;
}

int main(){
  solve();
  return 0;
}

C++: #include<iostream>

using namespace std;

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

}


int main(){
    int n;

    cin >> n;

    cout << fibonacci(n) << endl;

}

C++: #include <iostream>

using namespace std;


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

    int dp[45];
    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;
using UL = unsigned int;
using ULL = unsigned long long;
using LL = long long;
#define rep(i,n) for(UL i=0; i<(n); i++)

UL N;
UL F[45];

int main() {
 cin>>N;
 F[0]=F[1]=1;
 for(UL 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;

long long Fib_itr(int n){
    long long fib_n1 = 1, fib_n2 = 1;
    for (int i = 1; i < n; i++)
    {
        fib_n1 += fib_n2;
        fib_n2 = fib_n1 - fib_n2;
    }
    return fib_n2;
}

int main(){
    int n; cin >> n;
    cout << Fib_itr(n+1) << endl;
}

C++: #include <iostream>

using namespace std;
static const int INI =  -1;
 int f[66];

int fib(int n){

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

int main(){

 
  int n;
  for(int i = 0;i <= 66; i++){
    f[i] = INI;
  }

  cin >> n;

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

C++: #include <iostream>

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

std::cout<<fib<<std::endl;

C++: #include <stdio.h>

int main() {
    int a = 1, b = 1, c = 2, i = 2;
    int n;
    scanf("%d", &n);
    while (i < n) {
        a = b;
        b = c;
        c = a + b;
        i++;
    }
    if (n<2){
        printf("1\n");
    }else{
        printf("%d\n", c);
    }
    return 0;
}

C++: //
//  main.cpp
//  ALDS1_10_A:FibonacciNumber
//
//  Created by Kang on 2020/8/12.
//  Copyright © 2020 Kang. All rights reserved.
//

#include <cstdio>
#include <cstring>
using namespace std;


int fiboFromTop(int n, int fibo[]) {
    if (fibo[n] != 0) {
        return fibo[n];
    }
    
    if (n == 0 || n == 1) {
        fibo[n] = 1;
        return 1;
    }
    else {
        fibo[n - 1] = fiboFromTop(n-1, fibo);
        fibo[n - 2] = fiboFromTop(n - 2, fibo);
        return fibo[n - 1] + fibo[n - 2];
    }
    
    
    return 0;
}

int fiboFromBottom(int n) {
    if (n == 0 || n == 1) {
        return 1;
    }
    int fibo[45];
    fibo[0] = 1;
    fibo[1] = 1;
    for (int i = 2; i <= n; i++) {
        fibo[i] = fibo[i-1] + fibo[i - 2];
    }
    return fibo[n];
}

int main(int argc, const char * argv[]) {
    // insert code here...
    int n;
    int fibonacci[45];
    memset(fibonacci, 0, 45 * sizeof(int));
    scanf("%d", &n);
    
    // printf("%d\n", fiboFromTop(n, fibonacci));
    printf("%d\n", fiboFromBottom(n));
    
    return 0;
}