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++: #define _USE_MATH_DEFINES
#include<iostream>
#include<iomanip>
#include<algorithm>
#include<bitset>
#include<cctype>
#include<climits>
#include<cmath>
#include<cstdio>
#include<deque>
#include<list>
#include<map>
#include<set>
#include<stack>
#include<string>
#include<sstream>
#include<queue>
#include<vector>
using namespace std;

int F[45] = {};

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

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

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

int fib(int n){
	int ans[45] = {0,1},i;
	for(i=2;i<=n;i++){
		ans[i] = ans[i-1]+ans[i-2];
	}
	return ans[i];
}

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

C++: #include <bits/stdc++.h>
using namespace std;
/*{{{*/  //template
#define rep(i,n) for(int i=0;i<n;i++)
#define INF 1<<29
#define LINF LLONG_MAX/3
#define mp make_pair
#define pb push_back
#define EB emplace_back
#define fi first
#define se second
#define all(v) (v).begin(),(v).end()
#define sz(x) (int)(x).size()
#define debug(x) cerr<<#x<<":"<<x<<endl
#define debug2(x,y) cerr<<#x<<","<<#y":"<<x<<","<<y<<endl
//struct fin{ fin(){ cin.tie(0); ios::sync_with_stdio(false); } } fin_;
struct Double{ double d; explicit Double(double x) : d(x){} };
ostream& operator<<(ostream& os,const Double x){ os << fixed << setprecision(20) << x.d; return os; }
template<typename T> ostream& operator<<(ostream& os,const vector<T>& vec){ os << "["; for(const auto& v : vec){ os << v << ","; } os << "]"; return os; }
template<typename T,typename U> ostream& operator<<(ostream& os,const pair<T,U>& p){ os << "(" << p.first << ","<< p.second <<")"; return os; }
typedef long long ll;
typedef unsigned long long ull;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<vi> vvi;
ll gcd(ll a,ll b){ if(b==0) return a; else return gcd(b,a%b); }
constexpr double eps = 1e-14; 
constexpr ll mod = 1e9+7;
const int dx[]={1,0,-1,0} ,dy[] = {0,1,0,-1};
/*}}}*/

ll memo[64];

ll fib(int n){
    if(memo[n]!=-1) return memo[n];
    if(n==0 or n==1) return memo[n]=1;

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

int main(){
    rep(i,64) memo[i]=-1;

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

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;

typedef long long signed int ll;

constexpr ll NIL = -20000000000;

ll fib(int n) {
    if(n < 2) return n;
    return fib(n-1) + fib(n-2);
}

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

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

int Fibonacci(int n){
	if(n==0 || n==1){
		return 1;
	}
	return 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 fib(int n);

int main() {
    int n;

    //??\???
    cin >> n;

    //??????
    cout << fib(n) << endl;

    return 0;
}

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

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



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

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

int dp[50];

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

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

    return 0;
}

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

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

C++: // 

// g++ -std=c++11 abc145_c.cc && ./a.out 
#include <algorithm>
#include <bitset>
#include <cmath>
#include <functional>
#include <iomanip>
#include <ios>
#include <iostream>
#include <numeric>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <unordered_map>
#include <vector>
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
using namespace std;
using ll = long long;
using P = pair<int,int>;


int memo[50];
int n;

int fibo(int i) {
    if (memo[i] != 0) { return memo[i]; }

    int result = fibo(i - 1) + fibo(i - 2);
    memo[i] = result;
    return result;
}

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

    rep(i, n) memo[i] = 0;
    memo[0] = 1;
    memo[1] = 1;

    cout << fibo(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){
  int dp[1000];
  dp[0] = 1;
  dp[1] = 1;

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

C++: #include<functional>
#include<algorithm>
#include<iostream>
#include<utility>
#include<string>
#include<vector>
#include<cmath>
#include<stack>
#include<queue>
#include<deque>
#include<map>
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,x,n) for(int i=x;i<n;i++)
#define all(v) (v).begin(),(v).end()
#define pf push_front
#define pb push_back
#define int long long
using namespace std;
const int INF=1000000007;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};

int f[50]={};

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

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

  return 0;
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <map>
#include <stack>
#include <queue>
#include <deque>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <climits>
#include <cstring>
#define rep(i, begin, end) for (__typeof(end) i = (begin) - ((begin) > (end)); i != (end) - ((begin) > (end)); i += 1 - 2 * ((begin) > (end)))

using namespace std;

const int N_MAX = 1000000;
int dp[N_MAX];


int fib(int n, int* dp){
  if(n==0) dp[n] = 1;
  if(n==1) dp[n] = 1;

  if(dp[n] >= 0) return dp[n];
  else dp[n] = fib(n-2, dp) + fib(n-1, dp);
  return dp[n];
}

int main(){
  int n;
  cin >> n;
  memset(dp, -1, N_MAX * sizeof(dp[0]));
  cout << fib(n, dp) << endl;
  return 0;
}

C++: #include<iostream>
using namespace std;
#define n 44
int F[n],Fl[n];
int fibonacci(int na)
{
    if( na == 1 || na == 2)
        return F[na] = 1;
    if(F[na])
        return F[na];
    return F[na] = fibonacci(na - 1) +fibonacci(na - 2 ) ;
}

void makeFibonacci()
{
    Fl[1] = Fl[0] = 1;
    for(int i=2;i<=n;i++)
    {
        Fl[i] = Fl[i-1] + Fl[i-2];
    }
}

int main()
{
    int na;
    cin>>na;
    //cout<<fibonacci(na)%10007<<endl;
    makeFibonacci();
    cout<<Fl[na]<<endl;
    return 0;
}

C++: #include<stdio.h>

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

C++: #include <cstdio>

using namespace std;

int sum = 0;

int fib( int n ){

    if( n >= 0) {

        if( n == 0 || n == 1 ){

            return 1;

        } else {

            sum = fib( n - 1 ) + fib( n - 2 );        

        }

    } else return 0;

    return sum;

}

int main(){

    int n;

    scanf("%d", &n);

    int ans = fib(n);

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

}