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<algorithm>
#include<string>
#include<cstring>
#include<cstdio>
#include<cstdlib>
#include<vector>
#include<queue>
#include<stack>
#include<complex>
#include<utility>
#include<cmath>
#define loop(i,a,b) for(int i=a;i<b;i++)
#define rep(i,a) loop(i,0,a)
#define pi acos(-1)
#define all(v) v.begin(),v.end()
using namespace std;

const double eps = 1e-8;
const double INF = 1e12;

typedef pair<long,long> P;
typedef double Real;
typedef complex<Real> Point;
typedef vector<Point> G;

double cross(const Point& a,const Point& b){//calculate ad-bc(vector product)
	return imag(conj(a)*b);
}

struct L:public vector<Point>{//line data
	L(const Point &a,const Point &b){
		push_back(a);
		push_back(b);
	}
};

int n;
int dp[31];

long long func(int i){//i??????????§???????n??????????????????????????°???????????¢??°
	long long res;
	if(dp[i]!=-1)return dp[i];
	if(i==n)return 1;
	else if(i==n-1)res=func(i+1);
	else if(i==n-2)res=func(i+1)+func(i+2);
	else res=func(i+1)+func(i+2)+func(i+3);
	return dp[i]=res;
}

int main(){
	while(cin>>n){
		if(!n)break;
		memset(dp,-1,sizeof(dp));
		long long sum=func(0);
		int ans=sum/3650;
		if(sum%365)ans++;
		cout<<ans<<endl;
	}
	return 0;
}

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

int num(int n);

int main(){
  int n;
  cin>>n;
  cout << num(n) <<endl;
}

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

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

int num(int n);

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

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

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

using namespace std;

int dp[31];

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

C++: #include <bits/stdc++.h>
using namespace std;
#define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
typedef long long ll;
// Welcome to my source code!

template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const int MAX_N = 31;

int main() {
    IOS
    ll dp[MAX_N] = {};
    dp[0] = 1;
    for (int i = 1; i < MAX_N; i++) {
        dp[i] += dp[i-1];
        if (i > 1) dp[i] += dp[i-2];
        if (i > 2) dp[i] += dp[i-3];
    }
    int n;
    while (cin >> n, n) {
        ll t = ceil(dp[n] / 3650.0);
        cout << t << endl;
    }
}

C++: #include <cstdio>
#include <algorithm>
#define MAX 31
using namespace std;

int main(){
	int n, array[MAX];
	fill(array, array + MAX, 0);
	array[0] = 1;
	array[1] = 2;
	array[2] = 4;
	for(int i = 3; i <= 30; i++) array[i] = array[i - 1] + array[i - 2] + array[i - 3];
	
	while(scanf("%d", &n)){
		if(n == 0) break;
		printf("%d\n", array[n - 1] / 10 / 365 + 1);
	}
	return 0;
}

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

int main()
{
	int n, p[31];
	p[0] = 1;
	p[1] = 1;
	p[2] = 2;
	for (int i = 3; i < 30; ++i)
	{
		p[i] = p[i-1] + p[i-2] + p[i-3];
	}
	while(1){
		int y;
		cin >> n;
		if(n == 0){
			break;
		}
		y = p[n] / (10 * 365) + 1;
		/*if(p[n] % (10 * 365) != 0){
			y++;
		}*/
		cout << y << endl;
	}
	return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <vector>
#include <algorithm>
#include <cmath>
#include <utility>

#define REP(i,n) for(int i = 0;i<(int)n;i++)
#define FOR(i,a,b) for(int i = (a);i < (b);i++)
#define RFOR(i,a,b) for(int i = (a);i>(b);i--)

using namespace std;

/* DP ??????*/
/* ????????????????????§?????????*/


int main(void){
    
    int dannsuu;
    int times[31] = {0};
    int year;
    times[0] = 1;
    times[1] = 1;
    times[2] = 2;
    
    while( cin >>dannsuu,dannsuu)
    {
        FOR(i, 3, dannsuu+1)
        times[i] = times[i-1]+times[i-2] + times[i-3];
        
        
        year = (times[dannsuu] /(365*10));
        
        if((times[dannsuu] % (365 * 10)))
            year +=1;
        
        cout << year << endl;
        
    }
    return 0;
    
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>
#include <tuple>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = 1e12;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define rep(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1

ll sq(ll num) { return num*num; }
ll mod_pow(ll x, ll n) {
	if (n == 0)return 1;
	if (n == 1)return x%MOD;
	ll res = sq(mod_pow(x, n / 2));
	res %= MOD;
	if (n % 2 == 1) {
		res *= x;
		res %= MOD;
	}
	return res;
}
ll mod_add(ll a, ll b) { return (a + b) % MOD; }
ll mod_sub(ll a, ll b) { return (a - b + MOD) % MOD; }
ll mod_mul(ll a, ll b) { return a*b % MOD; }

ll n;

ll solve(int now) {
	if (now == 0)return 1;
	if (now < 0)return 0;
	ll res = 0;
	res = solve(now - 1) + solve(now - 2) + solve(now - 3);
	return res;
}

int main() {
	while (cin >> n&&n) {
		cout << ceil(solve(n) / 3650) << endl;
	}
}

C++: #include <bits/stdc++.h>
#include <iostream>
#include<math.h>
using namespace std;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
int main()
{
    vector<int64_t>dp(31, 0);
    dp[0] = 1;
    for (int64_t i=1; i<=30; i++) {
        int64_t pattern = 0;
        pattern += dp[i-1];
        if (i > 1) pattern += dp[i-2];
        if (i > 2) pattern += dp[i-3];
        dp[i] = pattern;
    }

    int N;
    while (cin >> N) {
        if (N == 0) break;
        int64_t count = dp[N] / 3650;
        if (dp[N] % 3650 > 0) {
            count += 1;
        }
        cout << count << endl;
    }
    return 0;
}

C++: #include <iostream>
using namespace std;
long long solve(int now){
    if(now==0) return 1;
    if(now<0)  return 0;
    long long res=solve(now-1)+solve(now-2)+solve(now-3);
    return res;
}
int main(void){
    while(cin>>n&&n){
    cout<<solve(n)/3650+1<<endl;
    }
    // Your code here!
    
}

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

using namespace std;
typedef long long ll;

int main(){
	while(true){
		int n;
		cin >> n;
		if(n == 0){ break; }
		vector<ll> dp(n + 3);
		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] + 9) / 10 + 364) / 365 << endl;
	}
	return 0;
}

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


int f(int n) {
    if(n == 1) return 1;
    if(n == 2) return 2;
    if(n == 3) return 4;
    
    return f(n-1)+f(n-2)+f(n-3);
}
int main(void){
   while(true) {
       int n;
       cin >> n;
       if(n == 0) break;
       cout << (f(n) / 3650)+1  << endl;
   }
}