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 <algorithm>
#include <map>
#include <vector>
#include <iostream>
#include <sstream>
#include <cstdio>
#include <cstring>
#include <cctype>
#include <cstdlib>
#include <cmath>
#include <string>
#include <queue>
#include <stack>
#include <set>
#include <numeric>
#include <limits>
#include <bitset>
using namespace std;

#define all(c) ((c).begin()), ((c).end())
#define dump(c) cerr << "> " << #c << " = " << (c) << endl;
#define iter(c) __typeof((c).begin())
#define tr(i, c) for (iter(c) i = (c).begin(); i != (c).end(); i++)
#define REP(i, a, b) for (int i = a; i < (int)(b); i++)
#define rep(i, n) REP(i, 0, n)
#define mp make_pair
#define fst first
#define snd second
#define pb push_back
 
typedef unsigned int uint;
typedef long long ll;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<double> vd;
typedef vector<vd> vvd;
typedef vector<string> vs;
typedef pair<int,int> pii;

const int INF = 1<<29;
const double EPS = 1e-10;
double zero(double d){
  return d < EPS ? 0.0 : d;
}

template<typename T1,typename T2>
ostream& operator<<(ostream& os,const pair<T1,T2>& p){
    return os<<'('<<p.first<<','<<p.second<<')';
}
template<typename T>
ostream& operator<<(ostream& os,const vector<T>& a){
    os<<'[';
    rep(i,a.size()) os<<(i?" ":"")<<a[i];
    return os<<']';
}

const int M = 1000000007;

// a^k
ll fpow(ll a, ll k){
  ll res = 1ll;
  ll x = a;
  while( k!=0 ){
    if((k&1) == 1)
      res = res*x;
    x = x*x;
    k >>= 1;
  }
  return res;
}

int used[31];

int loop(int a){

  if(used[a]!=-1)
    return used[a];

  if(a==1)
    return 1;
  else if(a==2)
    return 2;
  else if(a==3)
    return 4;
  else 
    return (used[a] = loop(a-1) + loop(a-2) + loop(a-3));
}


int main()
{
  cout.setf(ios::fixed, ios::floatfield);
  cout.precision(8);
  ios_base::sync_with_stdio(false);
  
  int n;
  while(cin>>n, n){
    memset(used,-1,sizeof(used));
    cout << (int)ceil( (double)loop(n)/365/10 )  << endl;
  }


  return 0;
}

C++: #include <iostream>
#include <stdio.h>
using namespace std;
int main() {
 int d[35],i,j,n;
 for (i=0;i<35;i++) d[i]=0; d[0]=1;
 for (i=0;i<31;i++) for (j=1;j<4;j++) d[i+j]+=d[i];
 while(cin >> n) {
	 if (n==0) break;
	 cout << (d[n]/3650+1)-(d[n] % 3650 == 0)  << endl;
 }
 return 0;
 }

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

int main(){
	int n;
	int a[31] = {1,1,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]/10/365 + 1) << endl;
	}
}

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

using namespace std;

int main()
{
	int n, i, j;
	int dp[40];

	memset(dp, 0, sizeof(dp));
	
	dp[0] = 1;
	
	for( i = 0; i <= 30; i++)
	{
			for( j = 1; j <= 3; j++)
				dp[i+j] += dp[i];
	}
	
	while( cin >> n , n)
	{
		cout << ((dp[n] + 9)/10 + 364)/365 << endl;
	}
	
	return 0;
}

C++: #include <iostream>
#include <vector>
using namespace std;
int main() {
	int n;
	while (cin>>n) {
		if (!n) break;
		vector<int> dp(n+3,0);
		dp[0] = 1;
		for (auto i = 0; i < n; i++)
			for (auto j = 1; j <= 3; j++)
				dp[i+j] += dp[i];
		int day = dp[n]/10+!!(dp[n]%10),
		    year = day/365+!!(day%365);
		cout << year << endl;
	}
	return 0;
}

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

int main() {
  int n, d, y;
  int dp[31] = {0};
  dp[0] = 1;
  for (int i=1; i<=30; i++) {
    for (int j=0; j<3; j++) {
      if (i>j) dp[i] += dp[i-j-1];
    }
  }
  while (1) {
    cin >> n;
    if (!n) break;
    d = (dp[n] + 9) / 10;
    y = (d + 364) / 365;
    cout << y << endl;
  }
  return 0;
}

C++: #include<iostream>
#include<string>
#include<algorithm>
#include<set>
#include<map>
#include<vector>
#include<stack>
#include<queue>
#include<cmath>
#include<numeric>
using namespace std;


int main(){
    int dp[100]={};
    dp[1]=1;
    dp[2]=2;
    dp[3]=4;
    for(int i=4;i<=30;i++){
        dp[i]+=dp[i-1]+dp[i-2]+dp[i-3];
    }
    while(1){
        int n;
        cin>>n;
        if(n==0){break;}
        int ans=(dp[n]+3649)/3650;
        cout<<ans<<endl;
    }
    
    
    return 0;
}

C++: #include <stdio.h>
#include <iostream>
#include <string>



int main(void){
	
	int *num,t=0,a[4];
	a[0] = 0, a[1] = 1;
	int ans;
	num = new int[1000];

	do{
		std::cin >> num[t];
		t++;
	} while (num[t - 1] != 0);

	t = 0;
	while (num[t] != 0){
		a[0] = 0; a[1] = 0, a[2] = 1;
		for (int i = 0; i < num[t]; i++){
			a[3] = a[2] + a[1]+a[0];
			a[0] = a[1];
			a[1] = a[2];
			a[2] = a[3];
		}
		std::cout << (int)a[3]/365/10+1<<std::endl;
		t++;
	}


	return 0;
}

C++: #include <cstdio>
int dp[31]={1,1,2};
int main() {
	for(int i=3;i<=30;i++) {
		dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
	}
	int n;
	while(scanf("%d",&n),n) {
		int days=dp[n]/10+((dp[n]%10)?1:0);
		int years=days/365+((days%365)?1:0);
		printf("%d\n",years);
	}
}

C++: a = [1, 1, 2]
for i in range(3, 31):
    a.append(sum(a[-3:]))

while True:
    n = int(input())
    if not n:
        break
    print(((a[n] + 9) / 10 + 364) / 365)

C++: main()
{
	int n,i;
	int ans[64]={0};
	
	ans[0]=ans[1]=1;
	ans[2]=2;
	
	for(i=3;i<31;i++)
		ans[i]=ans[i-1]+ans[i-2]+ans[i-3];
	
	for(;;)
	{
		cin >> n ;
		if(n==0)
			break;
		printf("%d\n",ans[n]/3650+1);
	}
}

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

//a[n]=a[n-1]+a[n-2]+a[n-3]を求める関数

int f(int n){  //再帰関数
   if(n==1) return 1;
   if(n==2) return 2;
   if(n==3) return 4;
   //f(n)=f(n-1)+f(n-2)+f(n+3);
   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;
   }
}

C++: #include <iostream>

using namespace std;
unsigned long long int dp[31];

void solve()
{
	dp[0] = 1;
	dp[1] = 1;
	dp[2] = 2;
	for(int i = 3; i < 31; ++i)
	{
		dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3];
	}
	int n;
	while(cin >> n, n)
	{
		cout << dp[n] / 3650 + 1 << endl;
	}
}

int main()
{
	solve();
	return(0);
}

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

#define MIN(X,Y) ((X)<(Y)?(X):(Y))

int main(void){
  int n,dp[32];
  
  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];
  }
  
  while (cin >> n){
    int ans;
    if (n==0) break;
    ans = ((dp[n]+9)/10+364)/365;
    cout << ans << endl;
  }
  return 0;
}

C++: #include <cstdio>
using namespace std;
int dp[31];
int main() {
    int n;
    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];
    }
    while(true){
        scanf("%d",&n);
        if(n==0) break;
        int day=dp[n]/10;
        printf("%d\n",(day+364)/365);
    }
    return 0;
}

C++: #include <iostream>
 
using namespace std;
 
int main()
{
    int T[31];
    T[0] = 1;
    T[1] = 1;
    T[2] = T[1]+T[0];
    for (int i=3; i<=30; i++)
        T[i] = T[i-1]+T[i-2]+T[i-3];
    for (int i=0; i<=30; i++)
        T[i] = T[i]/3650+1;
 
    while (true)
    {
        int n;
        cin>>n;
        if (n==0)
            break;
        cout<<T[n]<<endl;
    }
}

C++: #include <iostream>
#include <cmath>
int n;

int cnt(int i){
	if(i == 1)	return 1;
	if(i == 2)	return 2;
	if(i == 3)	return 4;

	return cnt( i-3 ) + cnt( i-2 ) + cnt( i-1 );
}


int main(void){
	while(1){
		std::cin >> n;
		if(n == 0)	return 0;
		std::cout << std::ceil(cnt(n) / 10.0 / 365.0) << std::endl;
	}
}