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<cstdio>
#include<iostream>
#include<string>
#include<set>
#include<map>
#include<vector>
#include<deque>
#include<tuple>
#include<algorithm>
#include<numeric>
#include<limits>
using namespace std;
#define BEGIN ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL)
#define END return EXIT_SUCCESS
#define rep(I,N) for(auto I=0;I<(N);++I)
#define up(I,A,B) for(auto I=(A);I<=(B);++I)
#define dw(I,A,B) for(auto I=(A);I>=(B);--I)
#define all(C) (C).begin(),(C).end()
#define rall(C) (C).rbegin(),(C).rend()
#define ft first
#define sd second
#define mp make_pair
#define mt make_tuple
#define pf push_front
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define rs resize
typedef long long ll;
typedef unsigned long long ull;
template<class T>inline bool chmax(T& a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>inline bool chmin(T& a,T b){if(a>b){a=b;return 1;}return 0;}
template<class T>inline void                                      in(T &p){cin>>p;}
template<class T1,class T2>inline void                            in(T1 &p1,T2 &p2){cin>>p1>>p2;}
template<class T1,class T2,class T3>inline void                   in(T1 &p1,T2 &p2,T3 &p3){cin>>p1>>p2>>p3;}
template<class T1,class T2,class T3,class T4>inline void          in(T1 &p1,T2 &p2,T3 &p3,T4 &p4){cin>>p1>>p2>>p3>>p4;}
template<class T1,class T2,class T3,class T4,class T5>inline void in(T1 &p1,T2 &p2,T3 &p3,T4 &p4,T5 &p5){cin>>p1>>p2>>p3>>p4>>p5;}
template<class T>inline void                                      ins(T &p){for_each(all(p),in<decltype(p[0])>);}
template<class T>inline void                             out(T p){cout<<p<<endl;}
template<class T1,class T2>inline void                   out(T1 p1,T2 p2){cout<<p1<<" "<<p2<<endl;}
template<class T1,class T2,class T3>inline void          out(T1 p1,T2 p2,T3 p3){cout<<p1<<" "<<p2<<" "<<p3<<endl;}
template<class T1,class T2,class T3,class T4>inline void out(T1 p1,T2 p2,T3 p3,T4 p4){cout<<p1<<" "<<p2<<" "<<p3<<" "<<p4<<endl;}
inline                                              void out(double p){printf("%.10f\n",p);}
template<class T>inline                             void outs(T p){for_each(all(p),out<decltype(p[0])>);}
template<class T>inline void outs(vector<T> V){int n=V.size();rep(i,n)cout<<V[i]<<" \n"[i==n-1];}
long dp[32];
inline void solve(void){
  dp[0]=1;
  dp[1]=1;
  dp[2]=2;
  up(i,3,30){
    dp[i]=dp[i-3]+dp[i-2]+dp[i-1];
  }
  int n;
  while(cin>>n,n){
    cout<<((dp[n]+9)/10+364)/365<<endl;
  }
}
int main(int argc,char**argv){
  BEGIN;
  solve();
  END;
}

C++: #include <stdio.h>
#include <iostream>
#include <cstdio>
using namespace std;
int x, c=0;
void dfs(int pos) {
	if (pos == 1) {
		c++;
		return;
	}else if (pos == 2) {
		c = c + 2;
		return;
	}
	else if (pos == 3) {
		c = c + 4;
		return;
	}
	else {
		dfs(pos - 1);
		dfs(pos - 2);
		dfs(pos - 3);
	}


}

int main() {
	while (1) {
	int	days = 0, years = 0;
	cin >> x;
	if (x == 0) {
		break;
	}
	dfs(x);
	days = c / 10;
	if (c % 10 != 0) {
		days++;
	}
	years = days / 365;
	if (days % 365 != 0) {
		years++;
	}
	cout << years << endl;
	}
	

}

C++: #include <iostream>
using namespace std;
int main(){
  int n;cin >> n;
  cout << num(num(n)/3650+1) <<endl;
}

int num(int n){
  if(n<0)return 0;
  if(n==0)return 1;
  return num(n-1)+num(n-2)+num(n-3);
}

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

class Answer
{
public:
	Answer(){day = 10; year = 365;}
	
	int N;	//??\???
	int day;
	int year;
	unsigned long long count(int cnt);	//??¨??¢?´¢(???)
	void set();	//??\???
	void OutPut();	//???????????????
	
	bool empty();	//???????????¶?????????
	bool ans();	//?§£???
};

unsigned long long Answer::count(int cnt)
{
	if( cnt < 0)
		return 0;
	
	else if(cnt == 0)
		return 1;
	
	return count(cnt - 1) + count(cnt - 2) + count(cnt - 3);
}

void Answer::OutPut()
{
	if( N == 0 )
		return;
	int ans_ = 1;	//??????????????´???
	ans_ += (count( N )) / (day * year);	//??\???
	
	cout << ans_ << endl;;
}

void Answer::set()
{
	cin >> N;
}

bool Answer::empty()
{
	if( N == 0 )return false;
	else return true;
}

bool Answer::ans()
{
	set();
	OutPut();
	return empty();
}

int main()
{
	Answer ans;

	while( ans.ans() );
	return 0;
}

C++: 
/*****/

#include <iostream>
#include <array>
#include <vector>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <stack>
#include <map>
#include <iomanip>	//cout << fixed << setprecision(桁数);
#include <stdexcept>

using namespace std;
using ll = long long;

#define nextline() (std::cerr << "\n")
#define debug(x) (#x " : " + (x))
#define debug_cout(x) (std::cerr << #x << " : " <<  (x) << "\n")
#define debug_tabCout(n, x) (std::cerr << strMulti("\t",n) << #x << " : " <<  (x) << "\n")
#define debug_headCout(h, x) (std::cerr << h << " : " <<  (x) << "\n")
#define debug_tabHeadCout(n, h, x) (std::cerr << strMulti("\t",n) << h << " : " <<  (x) << "\n")

#define rep(i, n) for(int i=0, i##_len=(n); i<i##_len; i++)
#define rep1(i, n) for(int i=1, i##_len=(n); i<=i##_len; i++)
#define rrep(i, n) for(int i=(n)-1; i >= 0; i--)
#define rrep1(i, n) for(int i=(n); i > 0; i--)
#define all(x) (x).begin(), (x).end()
#define pair(a, b) make_pair(a, b);
//#define int long long
constexpr int INF = 2000000100;
constexpr ll DIV = 1000000007;	// 10e9+7
template<class T> bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
template<class T> bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> T divUp(T a, T b) { if (a % b == 0) { return a / b; } return a / b + 1; }
std::string strMulti(std::string t, int n) { std::string out = ""; for (int i = 0; i < n; i++) { out += t; } return out; }
template<class T> T math_P(T m, T n) { T ret = 1; for (T i = m; i > m - n; i--) { ret *= i; } return ret; }
template<class T> T math_C(T m, T n) { T ret = mathP(m, n); for (T i = 2; i <= n; i++) { ret /= i; } return ret; }
template<class T> bool compare_by_b(pair<T, T> a, pair<T, T> b) { if (a.second != b.second) { return a.second < b.second; } return a.first < b.first; }
template<class T> T math_gcd(T a, T b) { a = abs(a); b = abs(b); if (a < b) { std::swap(a, b); } T tmp; while (b != 0) { tmp = b; b = a % b; a = tmp; } return a; }
template<class T> T math_lcm(T a, T b) { a = abs(a); b = abs(b); if (a > b) { std::swap(a, b); } if (a == 1) { return b; } T i = a; while (i % b != 0) { i += a; } return i; }

/*****/

void Main()
{
	while (true)
	{
		int n;
		cin >> n;
		if (n == 0)	break;

		vector<ll> dp(n+10);
		dp[0] = 1;

		for (int i = 0; i < n; i++)
		{
			for (int j = 1; j <= 3; j++)
			{
				dp[i + j] += dp[i];
			}
		}

		cout << divUp(dp[n], 3650ll) << '\n';
	}
}

/*****/

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

	//std::cout << std::fixed << std::setprecision(10);

	Main();

	return 0;
}

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

int A[100];
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]/3650 + 1 << endl;
}