Go: package main

import (
	"bufio"
		"os"
	"strconv"
	"fmt"
)

var scanner = bufio.NewScanner(os.Stdin)

func main() {
	dp := make([]int , 30)
	dp[0] = 1 // 1段の階段の登り方
	dp[1] = 2 // 2段の階段の登り方
	dp[2] = 4 // 3段の階段の登り方
	for i := 3; i < 30; i++ {
		// n段の階段の登り方は
		// n-1段の階段の登り方+n-2段の階段の登り方+n-3段の階段の登り方
		dp[i] = dp[i-1]+dp[i-2]+dp[i-3] 
	}
	for scanner.Scan() {
		n, _ := strconv.Atoi(scanner.Text())
		if n == 0 {
			break
		}
		fmt.Println(((dp[n-1]+9)/10+364)/365)
	}
}

C++: #include <iostream>
using namespace std;
int main(){
  int n;
  while(true){
    cin >> n;
    if(n == 0){
      break;
    }
    int table[n+4];
    fill(table, table+(n+4), 0);
    table[0] = 1;
    for(int i = 0; i < n; ++i){
      cout << i << ": " << table[i] << endl;
      table[i+1] += table[i];
      table[i+2] += table[i];
      table[i+3] += table[i];
    }
    cout << (table[n] / 10 / 365) + 1<< endl;
  }
  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  int ans[31]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2,3,6,10,19,34,62,113,207,381,701,1288,2369,4357,8014,14740};
  while(1){
    cin>>ans[0];
    if(!ans[0])
      return 0;
    cout<<ans[ans[0]]<<endl;
  }
}

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

int A[30];
int main() {
  A[0] = 1;
  A[1] = 1;
  A[2] = 2;

  for(int i = 3; i < 30; i++) {
    A[i] = A[i-1] + A[i-2]+A[i-3];
  }
  int N;
  while(cin >> N && N)
    cout << ((A[N]+364)/10+364)/365 << endl;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int a[31]={},m,l,n;
    a[1]=1;
    a[2]=2;
    a[3]=4;
    for(int i=4;i<31;i++){
        a[i]=a[i-1]+a[i-2]+a[i-3];
    }
    while(true){
        cin >>n;
        m=(a[n]/10)+1;
        l=(m/365)+1;
        if(n==0)break;
        cout <<l<<endl;
    }
}

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

int dp[31];

const int DIV = 3650;

int main(void)
{
	while(1){
		int num;
		cin >> num;
		if(num == 0)
			return 0;
		memset(dp,0,sizeof(dp));
		dp[0] = 1;
		for(int i=1;i<=num;++i){//どの段から？
			for(int j=1;j<=3;++j){//何段？
				if(i-j < 0)
					continue;
				dp[i] += dp[i-j];
			}
		}
		cout << ceil((double)dp[num]/DIV) << endl;
	}
	return 0;
}

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

int main(void)
{
	int n;
	int data[40];
	
	for (int i = 0; i < 40; i++) data[i] = 0;
	data[0] = data[1] = 1;
	data[2] = 2;
	
	for (int i = 3; i <= 30; i++){
		data[i] = (data[i - 1] + data[i - 2] + data[i - 3]);
//		cout << i << " " << data[i] << endl;
	}
	
	while (cin >> n, n){
		cout << ((data[n] / 10) + 365) / 365 << endl;
	}
	
	return 0;
}

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

int main(){
  int N;
  
  while(cin>>N){
    if(N==0){
      return 0;
    }
    int dp[N];
    dp[1]=1;
    dp[2]=2;
    dp[3]=4;
    if(N<4){
      cout<<1<<endl;
      continue;
    }
    for (int i=4;i<N+1;i++){
      dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
    }
    cout<<dp[N]/3650+1<<endl;
  }
  return 0;
}

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

int A[30];
int main() {
  A[0] = 1;
  A[1] = 1;
  A[2] = 2;

  for(int i = 3; i <= 30; i++) {
    A[i] = A[i-1] + A[i-2]+ A[i-3];
  }
  int N;
  while(cin >> N && N)
    cout << ((A[N]+364)/10+364)/365 << endl;
}

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

using i64 = int64_t;

int main(){
    int n;
    while(cin >> n, n != 0){
        vector<i64> dp(n+4);
        dp[0] = 1;
        for(int i=0;i<n;++i){
            dp[i+1] += dp[i];
            dp[i+2] += dp[i];
            dp[i+3] += dp[i];
        }
        cout << (dp[n] + 3649) / 3650 << endl;
    }

    return 0;
}

C++: #include <iostream>
#include <string>
#include <numeric>
#include <algorithm>
#include <vector>

using namespace std;

int main()
{
	int n;
	vector<int> num;
	do
	{
		cin >> n;
		num.push_back(n);
	}while (n != 0);
	num.pop_back();

	int dp[30];
	dp[0] = 1;
	dp[1] = 2;
	dp[2] = 4;

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

	for (auto it = num.begin(); it != num.end(); it++)
	{
		cout << dp[*it - 1]/3650 + 1 << endl;
	}
	return 0;
}

C++: #include<map>
#include<set>
#include<list>
#include<cmath>
#include<queue>
#include<stack>
#include<cstdio>
#include<string>
#include<vector>
#include<complex>
#include<cstdlib>
#include<cstring>
#include<climits>
#include<numeric>
#include<sstream>
#include<iostream>
#include<algorithm>
#include<functional>
#include<cctype>

#define mp make_pair
#define pb push_back
#define REP(i,a,n) for(int i = a;i < (n);i++)
#define rep(i,n) for(int i = 0;i < (n);i++)
#define all(s) s.begin(), s.end()
#define rall(s) s.rbegin(), s.rend()

using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<vector<int> > VII;
typedef pair<int,int> PII;

const int DX[]={1,0,-1,0},DY[]={0,-1,0,1};

int n;
LL memo[31];

LL solve(int cnt){
	if(memo[cnt] != -1) return memo[cnt];
	if(cnt >= n) return memo[cnt] = cnt == n;
	LL res1 = memo[cnt] = solve(cnt + 1);
	LL res2 = memo[cnt] = solve(cnt + 2);
	LL res3 = memo[cnt] = solve(cnt + 3);
	return memo[cnt] = res1 + res2 + res3;
}

int main(){
	cin.tie(0);
   	ios::sync_with_stdio(false);
	while(1){
		rep(i,31)
			memo[i] = -1;
		cin >> n;
		if(n == 0) break;
		LL ans = solve(0);
		cout << ans / 10 / 365 + 1 << endl;
	}

	return 0;
}

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


int main(){
  cin.tie(0);
  ios::sync_with_stdio(false);
  long long d[31];
  d[1]=1;d[2]=2;d[3]=4;
  REP(i,4,31)d[i]=d[i-1]+d[i-2]+d[i-3];
  int n;
  while(cin>>n,n){
  if(d[n]%3650==0)cout<<d[n]/3650<<endl;
  else cout<<d[n]/3650+1<<endl;
  }
  return 0;
}

C++: #include <iostream>

#define reep(i,n,m) for(int i=(n);i<(m);i++)
#define rep(i,n) reep(i,0,n)

using namespace std;

int main(){
    int n;
    while(cin >> n,n){
        int dp[35]={0};
        dp[0]=1;
        rep(i,n){
            dp[i+1] += dp[i];
            dp[i+2] += dp[i];
            dp[i+3] += dp[i];
        }

        cout << dp[n]/(365*10)+1 << endl;
    }
    return 0;
}

C++: #include <iostream>
#include <vector>
#include<queue>
using namespace std;
#define loop(i,n) for (int i = 0; i < n; i++)
int main()
{
	int n;
	cin >> n;
	vector<long long int> dp(n + 1, 0);
	dp[0] = 1;
	loop(i, n)
	{
		dp[i + 1] += dp[i];
		if (i + 2 < n + 1)dp[i + 2] += dp[i];
		if (i + 3 < +n + 1)dp[i + 3] += dp[i];
	}
	cout << (((dp[n] + 9) / 10) + 364) / 365 << endl;
	return 0;
}

C++: #include <stdio.h>

int stair(int x) {

  if(x==1) return 1;

  else if(x==2) return 2;

  else if(x==3) return 4;

  else return stair(x-1)+stair(x-2)+stair(x-3);

}

int main(void) {

  int n;

  int step;
  int day,year;


  while(1) {

    scanf("%d",&n);

    if(n==0) break;

    step=stair(n);

    if(step%10==0) day=step/10;

    else day=step/10+1;

    if(day%365==0) year=day/365;

    else year=day/365+1;

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

  }

  return 0;

}

C++: #include <iostream>
#include <cstdio>

using namespace std;

int main()
{
	int n;
	int a, b, c, d, ans;
	int i;

	

	while (1) {
		scanf("%d", &n);
		if (n == 0) break;
		a = 1;
		b = 2;
		c = 4;

		if (n == 1) d = a;
		if (n == 2) d = b;
		if (n == 3) d = c;

		for (i = 4; i <= n ; i++) {
			
			d = a + b + c;
			a = b;
			b = c;
			c = d;
		}

		ans = d / 3650;
		if (d % 3650 != 0) ans++;
		printf("%d\n", ans);
	}

	
	return (0);
}