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++: #pragma GCC optimize ("O3")

#include <bits/stdc++.h>

using namespace std;

#ifdef LOCAL
#include <prettyprint.hpp>
#define debug(...)  cerr << "[" << #__VA_ARGS__ << "]: ", d_err(__VA_ARGS__);
#else
#define debug(...) 83;
#endif

void d_err() {
    cerr << endl;
}

template <typename H, typename... T>
void d_err(H h, T... t) {
    cerr << h << " ";
    d_err(t...);
}

template <typename T>
void print(T x) {
    cout << x << "\n";
}

#define ALL(x) (x).begin(), (x).end()
#define FOR(i, m, n) for (int i = (m); i < (n); ++i)
#define REVFOR(i, m, n) for (int i = (n - 1); i >= (m); --i)
#define REP(i, n) FOR(i, 0, n)
#define REVREP(i, n) REVFOR(i, 0, n)
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define eb emplace_back
#define bcnt __builtin_popcountll

typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<ll,ll> Pll;
typedef pair<int,int> Pin;

ll INF = 1e16;
int inf = 1e9;
ll MOD = 1e9+7;


int main() {
    cin.tie(0);
    ios_base::sync_with_stdio(false);
    cout << fixed << setprecision(20);

    int n; cin >> n;

    vll v(n + 1);
    v[0] = 1;
    v[1] = 1;

    FOR(i, 2, n + 1) {
        v[i] = v[i - 1] + v[i - 2];
    }

    print(v[n]);

}

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

C++: #include <iostream>
using namespace std;
int memo[1000];
int fib(int n){
    if(n == 0 || n == 1){
        return (memo[n] = 1);
    }else{
        if(memo[n-2] == 0) memo[n-2] = fib(n-2);
        if(memo[n-1] == 0) memo[n-1] = fib(n-1);
        if(memo[n] == 0) memo[n] = memo[n-2] + memo[n-1];
        return memo[n];
    }
}

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

C++: #include <bits/stdc++.h>
#define rep(i,n) for (int i = 0; i < (n); ++i)
using namespace std;
typedef long long ll;

int F[100];

int Fibo(int k){
    if(k == 0 || k == 1){
        return F[k] = 1;
    } else if(F[k] != 0){
        return F[k];
    } else {
        return F[k] = Fibo(k-2) + Fibo(k-1);
    }
}

int main() {
    int n; cin >> n;
    int ans = Fibo(n);
    cout << ans << endl;

    return 0;
}

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


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

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

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

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

C++: #include<bits/stdc++.h>
#include<string>
#include<vector>
using namespace std;
typedef pair<int, int>P;
typedef long long ll;
#define rep(i,n)for(ll i=0;i<n;++i)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
//max=({});
//条件式が真ならwhileの中身を回し続ける
//printf("%d\n", ans);

//pairの入力
//vector<pair<ll, ll>>work(n);
//rep(i, n) {
//	ll a, b;
//	cin >> a >> b;
//	work[i] = make_pair(a, b);
//for(auto p:mp)(mapの探索)
//printf("%.10f\n",なんちゃら)
//最大公約数
ll gcd(ll x, ll y) {
	return y ? gcd(y, x % y) : x;
}

ll lcm(ll x, ll y) {
	if (x == 0 || y == 0)return 0;
	return (x / gcd(x, y) * y);
}

//素因数分解
map<ll, ll>ins;
void facterize(ll n) {
	ll a = 2;
	while (n >= a * a) {
		if (n % a == 0) {
			ins[a]++;
			ins[a] = ins[a] % 1000000007;
			n /= a;
		}
		else {
			a++;
		}
	}
	ins[n]++;
}

vector<ll>relation[20], money(20, 1);
int dp[110][110];

int keta(int x) {
	int y = 0;
	while (x > 0) {
		y++;
		x /= 10;
	}
	return y;
}

ll dx[4] = { 0,0,-1,1 };
ll dy[4] = { -1,1,0,0 };

//long longしか使わない
int main() {
	ll n;
	cin >> n;
	vector<ll>f(n + 1);
	f[0] = 1;
	f[1] = 1;
	for (ll 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 fib(int n)
{
  int num[10000] = {1, 1};
  for (int i = 2; i <= n; i++){
    num[i] = num[i - 1] + num[i - 2];
  }
  return (num[n]);
}

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

C++: #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<stack>
#include<queue>
#include<vector>
#include<algorithm>
#include<string>
#include<iostream>
using namespace std;
long long int f[50];

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

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

C++: #include<iostream>
using namespace std;
int function(int n)
{
    if(n==0||n==1)
        return 1;
    else
        return function(n-1)+function(n-2);
}
int main()
{
    int n;
    cin>>n;
    cout<<function(n);
    return 0;
}

C++: #include <iostream>
#include <vector>
#define eol '\n'
using namespace std;

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

  vector<int> list(N,0);
  list[0] = list[1] = 1;
  
  int n;
  cin >> n;

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

  cout << list[n] << eol;
  
  return 0;
}

C++: #include<bits/stdc++.h>
#define rep(i,n)for(int i=0;i<n;i++)
using namespace std;

int f[50];
int main() {
	int n; scanf("%d", &n);
	f[0] = f[1] = 1;
	for (int i = 2; i <= n; i++)f[i] = f[i - 2] + f[i - 1];
	printf("%d\n", f[n]);
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin >> n;
    int d[n+1];
    d[0] = 1;
    d[1] = 1;
    for (int i = 2; i < n+1; i++)
    {
        d[i] = d[i-1] + d[i-2];
    }
    
    cout << d[n] << endl;
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define sz(x) int(x.size())
using namespace std;
typedef long long ll;

int main() {
  int n;
  cin >> n;
  int dp[n+1];
  dp[0] = 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++: #ifdef DEBUG
#include "../utils.cpp"
#endif
#include <bits/stdc++.h>
/*
Problem
 
Category
DP
 
URL:
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ALDS1_10_A&lang=ja

考察:


Date: 2020/04/18
*/
 

using namespace std;
using ll = int64_t;
#define int int64_t

 
/* ==== declarations ====== */
// functions
void solve();
void getInput();
 
// global variables
int n;
vector<int> dp;

/* ======================== */
int fib(int k) {
    if (dp[k] == 0) dp[k] = fib(k-1) + fib (k-2);
    return dp[k];
}

void getInput() {
    cin>>n;
    dp = vector<int>(n+1, 0);
    dp[0] = 1; dp[1] = 1;
}
 
 
void solve() {
    cout<<fib(n)<<endl;
}
 
 
 
signed main(){
    getInput();
    solve();
    return 0;
}

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

int main() {
  int a[45];
  a[0] = a[1] = 1;

  int n; cin >> n;

  for (int i = 2; i <= n; i++)
    a[i] = a[i-1] + a[i-2];

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

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    scanf("%d", &n);
    vector<long long> fib;
    fib.push_back(1);
    fib.push_back(1);
    for(int i = 2; i < 45; i++){
        long long val = fib.at(i - 1) + fib.at(i - 2);
        fib.push_back(val);
    }
    cout << fib.at(n) << endl;
}