Go: package main

import "fmt"

func main() {
	var n int
	fmt.Scan(&n)

	x, y := int64(1), int64(1)

	for i := 0; i < n; i++ {
		x, y = y, x+y
	}

	fmt.Println(x)
}

C++: #include <iostream>
#include <sstream>
#include <cstdio>
#include <stdlib.h>
#include <string>
#include <vector>
#include <algorithm>
using namespace std;
int f[45];
int fib(int n){
  if(n==1||n==0)return 1;
  if(f[n]!=0)return f[n];
  else return f[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;
#define rep(i,n) for(int i=0;i<n;i++)
#define numrep(i,n) for(int i=1;i<=n;i++)
#define bitrep(n) for(int bit=0;bit<(1<<n);bit++)
#define ll int64_t
#define all(v) v.begin(), v.end()

int main() {

int n; cin>>n;

vector<ll> dp(45);
dp[0]=1;
dp[1]=1;

for(int i=2;i<45;i++) dp[i]=dp[i-1]+dp[i-2];

cout << dp[n] << endl;

return 0;
}

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

int main(){
	int n,F[50];
	cin>>n;
	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>
#include <cstring>
using namespace std;
typedef unsigned long long ull;

ull dp[100];

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

int main(void)
{
  int N;
  cin >> N;
  memset(dp, -1, sizeof(dp));
  cout << fib(N) << endl;
}

C++: #include <iostream>
#include <stdio.h>
#include <string.h>
using namespace std;
/* 動的計画法
int main(){
    int n;
    int dp[100];
    dp[0]=1;
    dp[1]=1;
    cin >> n;
    for(int i=2;i<=n;i++){
        dp[i]=dp[i-1]+dp[i-2];
        //printf("dp[%d]=%d\n",i,dp[i]);
    }
    

    cout<<dp[n]<<endl;
}
*/
//メモ化再帰
int dp[100];
int n;
int fib(int n){
    if(n==0||n==1)return 1;
    if(dp[n]!=-1)return dp[n];
    return dp[n]=fib(n-1)+fib(n-2);
}

int main(){
    for (int i = 0; i < sizeof(dp)/sizeof(dp[0]); i++)
    {
        dp[i] = -1;
    }
    dp[0]=dp[1]=1;
    cin >> n;
    cout<<fib(n)<<endl;
}

C++: #include <algorithm>
#include<iostream>
#include<vector>
#include<list>
#include<map>
#include<set>
#include<string>
#include <sstream>

#include<stdlib.h>
#include<string.h>
#include<math.h>
#include<limits.h>

using namespace std;


int main(){
  long ii,jj,kk;
  vector<int> ret;
  long long fib[100];

  int n;

  cin >> n;

  fib[0] = 1;
  fib[1] = 1;

  for(ii=2;ii<=n;ii++){
    fib[ii] = fib[ii-1] + fib[ii-2];
  }

  cout << fib[n] << endl;

  
  
  return 0;
}

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


int fib(int n, int array[]) {
    array[0] = 1;
    array[1] = 1;
    for (int i= 2; i <= n; i++) {
        array[i] = array[i - 1] + array[i - 2];
    }
    cout << array[n];
}
int main(void) {

    cin >> num;
    int array[num] = {};
    fib(num, array);


}

C++: #include <iostream>
using namespace std;
int F[100];
int main() 
{
int n;
F[0] = 1;
F[1] = 1;
for (int i=2; i<45; ++i) 
{ // ???????????????
F[i] = F[i-2]+F[i-1];
}
cin>>n;
cout<<F[n];
}

C++: /*
** 本题使用两个stack，一个用来统计总积水，一个用来统计单独的积水面积。
*/

# include <cstdio>
# include <stack>
# include <vector>
using namespace std;

static const int maxn = 20000 + 10;

char buff[maxn];

int main() {
	// freopen("data.in", "r", stdin);
	// freopen("data.out", "w", stdout);
	while (scanf("%s", buff) != EOF) {
		/*
		** ts用来存储每一个'\'字符的位置，然后当出现'/'字符的时候，通过距离计算积水面积
		** ps用来存储每一个'\'所对应的积水面积，默认是0，当出现'/'后，再把面积加进去
		*/
		stack <int> ts, ps;
		int sum = 0;
		for (int i = 0; buff[i] != '\0'; i++) {
			if (buff[i] == 92) { // 92 是 '\'的 ascii码值
				ts.push(i);
				ps.push(0);
			}
			else if (buff[i] == 47 && !ts.empty()) { // 47 是 '/'的 ascii码值
				int s = i - ts.top(); ts.pop();
				sum += s;
				while (ps.top() != 0) { // 找到相对应的'\'，同时累加中间的积水面积
					s += ps.top();
					ps.pop();
				}
				ps.top() += s;
			}
		}
		
		printf("%d\n", sum);
		vector <int> v;
		while (!ps.empty()) {
			if (ps.top() != 0)
				v.push_back(ps.top());
			ps.pop();
		}
		if (v.size() == 0) // 针对积水面积为0的情况
			printf("0\n");
		else {
			printf("%d ", v.size());
			for (int i = v.size()-1; i > 0; i--)
				printf("%d ", v[i]);
			printf("%d\n", v[0]);
		}
	}
	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>
#include <vector>
using namespace std;

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n)  FOR(i,0,n)
#define VIEW(dat) for(auto v : dat){cout<<v<<endl;}

int dat[45];
int count;
int fib(int n){
	if(n<2){
		return 1;
	}else{
		if(dat[n]) return dat[n];
		dat[n]=fib(n-1)+fib(n-2);
		return dat[n];
	}
}

int main(){
	count=0;
	rep(i,45) dat[i]=0;	
	int n;
	cin>>n;
	cout<<fib(n)<<endl;
	return 0;
}

C++: #include <iostream>

using namespace std;

int main() {
    int n;  cin >> n;
    int *dp = new int[n+1];
    dp[0] = 1, dp[1] = 1;

    for (int i = 0; i + 2 <= n; i++)
        dp[i+2] = dp[i+1] + dp[i];

    cout << dp[n] << endl;

    return 0;
}

C++: #include <iostream>
#include <string>
#include <sstream>
#include <list>
#include <stack>
#include <queue>
#include <algorithm>
#include <utility>
#include <vector>
#include <map>
#include <cstring>
#include <cstdio>
#include <cmath>

using namespace std;

int f(const int);

int main()
{
    int N;
    cin>>N;
    cout<<f(N)<<endl;
}
int f(const int d)
{
    if(d<2)return 1;
    return f(d-1)+f(d-2);
}

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

int main() {
  int n; cin >> n;
  vector<int> a(n + 1);
  a[0] = 1, a[1] = 1;
  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;
#define rep(i, n) for(int i = 0, i##_len = (n); i < i##_len; ++i)
#define rep2(i, x, n) for(int i = x, i##_len = (n); i < i##_len; ++i)
#define all(n) begin(n), end(n)
using ll = long long;
using P = pair<int, int>;
using vi = vector<int>;
using vl = vector<ll>;
using vs = vector<string>;
using vc = vector<char>;
using vb = vector<bool>;
using vd = vector<double>;
vi dir = {-1, 0, 1, 0, -1, -1, 1, 1, -1};

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

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 << f[n] << endl;
}

C++: #include <algorithm>
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define ll long long
#define ld long double
#define INF 1000000000000000000
typedef pair<ll, ll> pll;

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

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

    int N;
    cin >> N;
    memset(F, -1, sizeof(F));
    cout << fibonacchi(N) << endl;

    return 0;
}

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

using namespace std;

#define FOR(i,s,e) for((i)=(s);(i)<(int)(e);(i)++)
#define REP(i,e) FOR(i,0,e)

#define all(o) (o).begin(), (o).end()
#define psb(x) push_back(x)
#define mp(x,y) make_pair((x),(y))

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

const double EPS = 1e-10;

const int N = 44;
int n;
int dp[N+1];

//???????£?
//recursive function(with/without memo)

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

int main() {
  memset(dp, 0, sizeof(dp));
  dp[0] = dp[1] = 1;
  scanf("%d ", &n);
  printf("%d\n", fib(n));

	return 0;
}