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<stdio.h>
#include<iostream>
#include<string>
#include<cstdlib>

using namespace std;

int main()
{
	int a[30], n,year;
	cin >> n;
	
	a[1] = 1;
	a[2] = 2;
	a[3] = 4;

	while (1)
	{
		if (n==0)
		{
			break;
		}
			for (int  i = 4; i < n+1; i++)
		{
				a[i] = a[i - 1] + a[i - 2] + a[i - 3];

		}
			if (a[n]%3650==0)
			{
				year = a[n] / 3650;
			}
			else
			{
				year = a[n] / 3650 + 1;
			}
			
		cout <<year<<endl;
		cin >> n;
	}
}

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <vector>
#include <string>
#include <set>
#include <map>
#include <stack>
#include <queue>
#include <algorithm>
#include <functional>
#include <iterator>
#include <limits>
#include <numeric>
#include <utility>
#include <cmath>

using namespace std; using namespace placeholders;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector< int > VI;
typedef vector< VI > VVI;
typedef vector< string > VS;
typedef stringstream SS;
typedef pair< int, int > PII;
typedef vector< pair< int, int > > VPII;

template < typename T > inline void input_n( vector< T > &out ) { copy_n( istream_iterator< T >( cin ), out.size(), out.begin() ); };
template < typename T > inline T fromString( const string &s ) { T res; istringstream iss( s ); iss >> res; return res; };
template < typename T > inline string toString( const T &a ) { ostringstream oss; oss << a; return oss.str(); };

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( e, c ) for ( auto &e : c )
#define ALL( c ) (c).begin(), (c).end()
#define AALL( a, t ) (t*)a, (t*)a + sizeof( a ) / sizeof( t )
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define EM emplace
#define EB emplace_back
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl

LL solve( const int N )
{
	static vector< LL > dp( 31, -1 );
	if ( N <= 0 )
	{
		return N == 0;
	}
	if ( dp[N] != -1 )
	{
		return dp[N];
	}

	LL res = 0;
	REP( i, N - 3, N )
	{
		res += solve( i );
	}
	return dp[N] = res;
}

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

	for ( int n; cin >> n, n; cout << ( solve( n ) + 3650 - 1 ) / 3650 << endl );

	return 0;
}

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

int main()
{
	int n, cnt, y;
	int c[31];

	c[0] = 1;
	c[1] = 1;
	c[2] = 2;
	for( int i=3; i<=30; i++ )
		c[i] = c[i-1] + c[i-2] + c[i-3];

	while( cin >> n, n != 0 ){
		y = c[n]/(365*10);
		y += !( c[n]%(365*10) == 0 );
		cout << y << endl;
	}

	return 0;
}

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

int n;
int memo[35];

int solve(int n){
  if(memo[n] != -1)return memo[n];
  int rec = 0;
  if(n == 0 || n == 1)return memo[n] = 1;
  else if(n == 2)return memo[n] = 2;
  for(int i = 1;i <= 3;i++){
    rec += solve(n - i);
  }
  return memo[n] = rec;
}

int main(){
  while(cin >> n , n){
    memset(memo,-1,sizeof(memo));
    int ans = solve(n);
    cout << (ans - 1) / 3650 +1 <<endl;
  }
}

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

int main() {
  int data[30];
  data[0] = 1;
  data[1] = 2;
  data[2] = 4;
  for(int i = 3; i < 30; i++) {
    data[i] = data[i-3] + data[i-2] + data[i-1];
  }
  while(1) {
    int n;
    cin >> n;
    if(n == 0) break;

    cout << ( (data[n-1]+10)/10 -1 )/ 365 + 1 << endl;
  }
  return 0;
}

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

int dp[50];

void print() {
   for (int i = 1; i < 33; i++) {
      cout << dp[i] << " ";
   }
   cout << endl;
}

void init() {
   dp[1] = 1, dp[2] = 2, dp[3] = 4;
   for (int i = 4; i < 33; i++) {
      dp[i] = dp[i-1] + dp[i-2] + dp[i-3];
   }
}

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

   return 0;
}

C++: #include<stdio.h>
int main()
{
	int ima=1,mae=0,l[10],i,j,a;
	scanf("%d",&a);
	for(i=0;i<a;i++){
		ima=ima+i;
	}
	mae=ima/365+1;
	printf("%d\n",mae);
	return 0;
}

C++: #include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll MOD = 1e9 + 7/*998244353*/;
const ll INF = 1LL << 60;
ll mod_pow(ll, ll, ll); ll mod_fact(ll, ll); ll mod_inv(ll, ll); ll gcd(ll, ll); ll lcm(ll, ll);
//
int main(){
    while(true){
        int n;
        cin >> n;
        if(!n) break;
        vector<ll> way(31);
        way[0] = 1;
        way[1] = 1;
        way[2] = 2;
        for(int i = 3; i <= n; i++){
            way[i] = way[i - 1] + way[i - 2] + way[i - 3];
        }
        int total = way[n];
        cout << ((total + 9) / 10 + 364) / 365 << endl;
    }
}

C++: #include <iostream>

using namespace std;

int main()
{
    int a[31] = { 0, 1, 2, 4 };
    for( int i=4; i<=30; ++i ) {
        a[i] = a[i-1] + a[i-2] + a[i-3];
    }

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

        cout << ( n == 1 ? 1 : (( a[n] / 10 / 365 ) + ( a[n] / 10 % 365 != 0 ) )) << endl;
    }
}

C++: #include "bits/stdc++.h"
using namespace std;
using ll = long long; using pii = pair<int, int>;
#define FOR(i,a,b) for(int (i)=(a);i<(int)(b);i++)
#define rep(i,n) FOR(i,0,n)

ll dp[40];

int main() {
    int n;
    while (cin >> n, n) {
        memset(dp, 0, sizeof(dp));
        dp[0] = 1;
        rep(i, n) {
            FOR(j, 1, 4) dp[i + j] += dp[i];
        }
        ll day = (dp[n] + 10 - 1) / 10;
        cout << (day + 365 - 1) / 365 << "\n";
    }

    return 0;
}

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

int main(){
    while(1){
        int n=0;
        cin>>n;
        if(n==0)break;
        int p[45]={0};
        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];
        }
        int ans=p[n]/3650;
        if(p[n]%3650>0)ans++;
        cout<<ans<<endl;
    }
    return 0;
}

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

using namespace std;


int main(){
        
        int A[128], N;
        A[0] = 1;
        for(int i=1; i<=32; i++){
                A[i] = A[i-1];
                if(i>=1) A[i] += A[i-2];
                if(i>=2) A[i] += A[i-3];
        }
        while (cin >> N  && N)  cout << (((A[N] + 9)/ 10) + 364) / 365 << endl;

}

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

int memo[300];
int dp(int num);

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

		memset(memo, -1, sizeof(memo));

		cout << (int)ceil(dp(n) / 3650.0) << endl;
		//cout << dp(n) << endl;
		
	}

	return 0;
}

int dp(int num){
	memo[0] = memo[1] = 1;
	memo[2] = 2;

	for(int i=3; i<=num; i++){
		memo[i] = memo[i-1] + memo[i-2] + memo[i-3];
	}

	return memo[num];
}

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

int main()
{
  while (true)
  {
    int n;
    cin >> n;
    if (!static_cast<bool>(n)) break;

    int DP[30 + 3] = {0};
    DP[0] = 1;

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

    int ans = (((DP[n] + 9) / 10) + 364) / 365;

    cout << ans << endl;
  }

  return 0;
}