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>
#include <cmath>
using namespace std;
#define rep2(x,from,to) for(int x=(from);x<(to);++(x))
#define rep(x,to) rep2(x,0,to)
int main(){
	int n;
	int dp[32] = {};
	dp[0] = dp[1] = 1;
	dp[2] = 2;
	rep2(i,3,32) {
		dp[i] = dp[i-3] + dp[i-2] + dp[i-1];
	}
	while(cin >> n, n) {
		cout << ceil(dp[n] / 3650.0) << endl;
	}
    return 0;
}

C++: #include<iostream>

int dp[30];//段数ー１

int main(){
	int n;
	while(std::cin>>n,n){
		std::memset(dp,0,sizeof(dp));
		dp[0]=1;
		dp[1]=2;
		dp[2]=4;
		for(int i=3;i<n;i++){
			dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
		}
		if(dp[n-1]%365==0)std::cout<<dp[n-1]/3650<<std::endl;
		else std::cout<<dp[n-1]/3650+1<<std::endl;
	}
	return 0;
}

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



int main(void)
{

	//入力変数
	int n = 0;

	//DP変数
	long long int h_dp[31] = {0};

	h_dp[0] = 1;
	h_dp[1] = 1;
	h_dp[2] = 2;

	//DPを列挙
	for (int i = 3; i <= 30; i++)
	{
		h_dp[i] = h_dp[i - 1] + h_dp[i - 2] + h_dp[i - 3];
	}

	while (true)
	{
		cin >> n;
		if (n == 0)	{	return 0;	}

		//年数出力
		long long int year = 0;

		if (n <= 10)
		{
			year = 1;
		}
		else
		{
			//求めたDPを利用
			year = h_dp[n] / 3650;
			if (h_dp[n] % 3650 != 0)
			{
				year++;
			}
		}

		cout << year << endl;
	}

	return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<iomanip>
#include<math.h>
#include<complex>
#include<queue>
#include<deque>
#include<stack>
#include<map>
#include<set>
#include<bitset>
#include<functional>
using namespace std;
#define REP(i,m,n) for(int i=(int)m ; i < (int) n ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
typedef pair<int,int> pint;
typedef pair<ll,int> pli;
const int inf=1e9+7;
const ll longinf=1LL<<60 ;
const ll mod=1e9+7 ;

int main(){
    ll a[40];
    a[0]=1;a[1]=1;a[2]=2;
    rep(i,30)a[i+3]=a[i+2]+a[i+1]+a[i];
    int n;
    while(cin>>n,n!=0){
        cout<<(a[n]+3649)/3650<<endl;
    }
    return 0;
}

C++: #define _CRT_SECURE_NO_WARNINGS
// #define _USE_MATH_DEFINES
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <string>
#include <vector>
#include <map>
#include <set>
#include <stack>
#include <cmath>
#include <cstdlib>
#include <functional>
#include <locale>
#include <cctype>
#include <sstream>
#include <iomanip>    // 10????????? cout << setprecision(10) << double;
#include <queue>
using namespace std;

typedef long long LL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef map<int, int> MAPII;
typedef multimap<int, char, greater<int> > MuMAPIC;
typedef vector<pair<int, int> > VPII;
typedef multimap<int, string, greater<int> > MuMIS;
typedef pair<int, int> P;
typedef pair<int, pair<P, P> > PP;

#define MP make_pair
#define FAST_IO  cin.tie(0); ios::sync_with_stdio(false);
#define FOR(i,a,b) for(int i=(a);i<(b);i++)
//for gcc (???test)
// #define FOREACH_IT(it,c) for(typeof(c)::iterator it=(c).begin(); it!=(c).end(); ++it)
//for Visual Studio
#define foreach_it(type,it,c) for(type::iterator it=c.begin(),c_end=c.end();it!=c_end;++it)
// for Debug.
#define DUMP_VVI(b) FOR(i,0,b.size()){FOR(j,0,b[i].size())printf("%d ",b[i][j]);puts("");}
#define D_OUT(str,value) if(dbgF){cout<<str<<" : "<<value<<endl;}
// ??\??????push_back(d)???array[d]???????????????1??????§?????????
// int INPUT_INT() {int d;cin>>d;return d;}
template<class T>T IN() { T d; cin >> d; return d; }
// ??????§????¢??´????°???Greatest Common Divisor???
LL gcd(LL a, LL b) { return (b > 0) ? gcd(b, a%b) : a; }
// ?????°?????¢??????°???Least Common Multiple???
LL lcm(LL a, LL b) { return a / gcd(a, b) * b; }
// Y???´???????????????´?????????
bool uruu(LL Y) { return (((Y % 4 == 0 && Y % 100 != 0) || Y % 400 == 0) ? true : false); }

// vector???¨???
// vec[i][j]?????????????\????????\?????????¨??????vec???????????????????????????????????????.

#define INF 1000000

// ------------------- include, typedef, define END. -------------------


int n;
LL patternNum = 0;

inline void nextStep(LL nowStep) {

	if (nowStep == n) {
		// GOAL
		patternNum++;
	}
	else if (nowStep>n) {
		// ?????°????????????
		
	}
	else {
		nextStep(nowStep + 1);
		nextStep(nowStep + 2);
		nextStep(nowStep + 3);
	}
}

int main() {

	while (cin >> n, n) {
		nextStep(0);
		int days = ceil(patternNum / 10.0);
		int years = ceil(days / 365.0);
		cout << years << endl;
		patternNum = 0;
	}

	return 0;
}

C++: #include<iostream>
#include<vector>
#include<map>

using namespace std;

struct Memo
{

  int count;
  bool flag;

  Memo()
  {
    count = 0;
    flag = false;
  }

};

int ProgressNumberOfYears(Memo memo[][4], int step_num, int step_kind)
{

  int kind_count = 0;


  if(step_num == 0) return 1;
  else if(step_num < 0)  return 0;
  else if(memo[step_num][step_kind].flag)  return memo[step_num][step_kind].count;
  for(int i = 1; i < 4; ++i)
    {
      kind_count = kind_count + ProgressNumberOfYears(memo,step_num - i,i);
    }

  memo[step_num][step_kind].count = kind_count;
  memo[step_num][step_kind].flag = true;

  return kind_count;

}

int main()
{

  int step_num;
  Memo memo[31][4];

  while(cin >> step_num && step_num != 0) cout << ProgressNumberOfYears(memo,step_num,0)/10/365 + 1<< endl;

  return 0;

}

C++: #include <iostream>
using namespace std;
int main(void){
    int a[31] ={};
    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){
    int i;
    cin >> i;
    if (i==0){
        break;
    }
    if (a[i]%3650 ==0){
        cout << a[i]/3650 ;
    }
    else {
        cout << a[i]/3650+1 << endl;
    }
}
    
    

    
}

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

int com(int x,int y){
  long long int ans;
  if(y==0)return 1;
  if(y==1)return x;
  ans = x;
  for(int i=1;i<y;i++)ans *= x-i;
  for(int i=0;i<y;i++)ans /= y-i;
  return ans;
}

int main(){
  int n;
  int a,d,y;

  while(1){
    cin >> n;
    if(!n)break;

    a = 0;
    for(int i=0;i<=n/3;i++){
      for(int j=0;j<=(n-3*i)/2;j++){
	a += com(i+j+(n-3*i-2*j),i+j) * com(i+j,i);
      }
    }

    d = a/10;
    if(d*10 != a)a++;
    y = d/365;
    if(y*365 != d)y++;
    cout << y << endl;
  }
}

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

int main()
{
	int n;
	int way[30];
	while (cin >> n)
	{
		if (n == 0) break;
		for (int i = 1; i <= n; i++)
		{
			if (i == 1)
			{
				way[i] = 1;
			}
			else if (i == 2)
			{
				way[i] = 2;
			}
			else if (i == 3)
			{
				way[i] = 4;
			}
			else
			{
				way[i] = way[i - 3] + way[i - 2] + way[i - 1];
			}
		}
		if (way[n] % 3650 == 0)
		{
			cout << way[n] / 3650 << endl;
		}
		else
		{
			cout << way[n] / 3650 + 1 << endl;
		}
	}

	return 0;
}

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

using namespace std;

int main(void)
{
	
	int n;
	int a[31];
	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];
	}
	
	while (cin>>n&&n){
		cout<<(a[n]+3649)/3650<<endl;
	}
}

C++: #include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    int dp[31];
    dp[1] = 1;
    dp[2] = 2;
    dp[3] = 4;
    while(cin >> n,n){
        if(n == 1 || n == 2 || n == 3)
            cout << 1 << endl;
        else{
            for(int i = 4; i <= n; i++)
                dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
            cout << dp[n] / 10 / 365 + 1 << endl;
        }
    }
}