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 <vector>
#include <list>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <complex>

#define pb push_back
#define mp make_pair
#define all(c) (c).begin(), (c).end()
#define rall(c) (c).rbegin(), (c).rend()
#define tr(c, i) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); ++i)
#define rtr(c, i) for (typeof((c).rbegin()) i = (c).rbegin(); i != (c).rend(); --i)
#define contains(c, x) ((c).find(x) != (c).end())
#define Contains(c, x) (find(all(c), x) != (c).end())
#define REP(i, a, b) for (int i = (a); i < (b); ++i)
#define rep(i, n) REP(i, 0, (n))
#define To_String to_string< char,std::char_traits<char>,std::allocator<char> >

typedef long long ll;
typedef unsigned long long ull;
using namespace std;

ll dp[31];
int main()
{
	ios_base::sync_with_stdio(0);
	dp[0] = 1;
	REP(i, 1, 31) REP(j, 1, min(4, i+1)) dp[i] += dp[i-j];
	int n;
	while (cin >> n, n) {
		ll t = (dp[n] + 9) / 10;
		ll res = (t + 364) / 365;
		cout << res << endl;
		//cout << res << "(" << dp[n] << ")" << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int a[100];

void init(int n){
	for (int i = 0; i < n; ++i){
		a[i] = 0;
	}
}

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

C++: #include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
#include <map>
#include <bitset>
#include <cstring>
#include <string>


using namespace std;
typedef long long int ll;
typedef vector<int>  VI;

#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()

#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define SORT(c) sort((c).begin(),(c).end())

#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
const double PI  = acos(-1.0);
#define CLR(a) memset((a), 0 ,sizeof(a))

long int takakuwa[50];

int a(int i){
	if(i<0) return 0;
	return takakuwa[i];
}

void solve(){
	takakuwa[0] =1;
	FOR(i,1,30){
		takakuwa[i] += a(i-1);
		takakuwa[i] += a(i-2);
		takakuwa[i] += a(i-3);



		

	}
}

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

	/*
	int n;
	cin >>n;
	for(int i;i<n;i++){
		cin >>;
	}
	*/

	solve();
	int n;
	while(cin >>n){
		if(n==0)return 0;
		//cout << takakuwa[n];
		cout << takakuwa[n]	/(10*365) +1 <<endl;
		}
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
int n;
int a[31];
int main()
{
	a[0]=1;
	a[1]=1;
	a[2]=a[0]+a[1];
	for(int i=3; i<31; i++)
	{
		a[i]=a[i-1]+a[i-2]+a[i-3];
	}
	while(cin >> n && n>0)
	{
		cout << (((a[n]+9)/10)+364)/365 << endl;
	}
	return 0;
}

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

#define int long long

int dp[50];
int n;

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

signed main() {
  init();
  while (1) {
    cin >> n;
    if (n == 0) break;
    int kind = dp[n] / 10;
    int year = kind / 365;
    int days = kind % 365;
    cout << max(1LL, year + (days >= 1)) << endl;
  }

  return 0;
}

C++: #include<iostream>
#include<string>
#include<vector>
#include<map>
#include<set>
#include<list>
#include<cstdio>
#include<cmath>
#include<iomanip>
#include<algorithm>
#include<functional>
#include<queue>
#include<stack>
using namespace std;
int main() {
	long long dp[31];
	int n;
	while (cin >> n&&n != 0) {
		for (int i = 0; i <= n; i++) {
			dp[i] = 0;
		}
		dp[0] = 1;

		for (int i = 0; i <= n; i++) {
			for (int j = 1; j <= 3; j++) {
				if (i - j >= 0) {
					dp[i] += dp[i - j];
				}
			}
		}
		long long a = ceil(dp[n] / 10.0);
		int b = a % 365;
		if (b == 0) cout << a / 365 << endl;
		else cout<<a / 365 + 1 << endl;
	}
}

C++: #include <iostream>
#include <algorithm>
#include <utility>
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,k,n) for(int i=k;i<n;i++)
using namespace std;

int main(){
	int n;
	while(cin>>n and n>0){
		int dp[50]; rep(i,50) dp[i]=0;
		dp[0]=1;
		rep(i,n+1){
			if(i==1) dp[i]=dp[i-1];
			if(i==2) dp[i]=dp[i-1]+dp[i-2];
			if(i>2) dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
		}
		cout<<(dp[n]-1)/3650+1<<endl;;
	}
	return 0;
}

C++: #include<iostream>

using namespace std;

int main(){

    while(1){
        int n;
        cin>> n;
        if(n==0) break;

        int dp[31];
        fill(dp, dp+31, 0);
        dp[1]=1; dp[2]=2; dp[3]=4;
        for(int i=4; i<=n; i++){
            dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
        }

        cout<< (dp[n]+3650-1)/3650<< endl;
    }

    return 0;
}

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

static const int N_MAX = 50;

int main() {
    static int dp[N_MAX];
    fill(dp, dp + N_MAX, 0);
    dp[0] = 1;
    for(int i = 0; i <= 30; i++) {
        dp[i + 1] += dp[i];
        dp[i + 2] += dp[i];
        dp[i + 3] += dp[i];
    }

    for(int N; cin >> N, N; ) {
        cout << ceil(dp[N] / (10.0 * 365)) << endl;
    }
}

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

int num(int n);

int main(){
  int n;
  cin>>n;
  cout << num(n)/3650 + 1<<endl;
}

int num(int n){
    switch (n)
    {
        case 1: return 1;
        case 2:  return 2;
        case 3:  return 4;
    }
  return num(n-1)+num(n-2)+num(n-3);
}

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

int N[40];

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

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<map>
#include<set>
#include<utility>
#include<vector>
#include<cmath>
#include<cstring>
#include<cstdio>
#include<time.h>
#define loop(i,a,b) for(int i=a;i<b;i++) 
#define rep(i,a) loop(i,0,a)
#define pb push_back
#define mp make_pair
#define all(in) in.begin(),in.end()
const double PI=acos(-1);
const double EPS=1e-10;
const int inf=1e8;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
vector<vector<char> >tmp;
vector<vector<int> >scr;
int main(){
	ll dp[30]={1,2,4};
	loop(i,3,30)dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
	int n;
	while(cin>>n,n){
		ll d=dp[n-1];
		d=(d+9)/10;
		cout<<(d+364)/365<<endl;
	}
}

C++: #include <iostream>
#include <vector>
#include <set>
#include <map>
#include <sstream>
#include <string>
#include <cstdio>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <functional>
#include <cstring>
#include <tuple>
#include <utility>
#include <unordered_set>

using namespace std;

typedef long long LL;
typedef vector<int> Array;
typedef pair<int, int> P;

const int INF = 1 << 29;
const LL MOD = 1000000009;
#define REP(i,n) for(int i=0;i<(int)n;++i)
#define ALL(c) (c).begin(), (c).end()

int main()
{
	int n;
	vector<int> dp(35);
	dp[0] = 1;
	REP(i, 30)REP(j, 3)dp[i + 1 + j] += dp[i];
	while (cin >> n && n)
	{
		cout << (dp[n] / 10 / 365 + 1) << endl;
	}
	return 0;
}