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 <bits/stdc++.h>

using namespace std;

typedef long long ll;

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

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

const int LIMIT = 31;

int main()
{
	int dp[ LIMIT ][ LIMIT ] = {0};
	int ans[ LIMIT ] = {0};

	dp[ 0 ][ 0 ] = 1;

	for( int i = 1; i < LIMIT; ++i ){
		for( int j = 0; j < 3; ++j ){
			for( int k = 0; k < i * 2 - 1; ++k ){
				int p = i + j + k;
				if( p >= LIMIT ) continue;
				dp[ i ][ p ] += dp[ i - 1 ][ i - 1 + k ];
				ans[ p ] += dp[ i - 1 ][ i - 1 + k ];
			}
		}
	}

	int n;
	while( cin >> n && n ){
		cout << ans[ n ] / 3650 + ( ans[ n ] % 3650 > 0 ? 1 : 0 ) << endl;
	}

	return 0;
}

C++: 
#include <stdio.h>
#include <math.h>
#include <algorithm>
#include <iostream>
using namespace std;

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

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

using namespace std;

int main(void){
	int way[32];
	int n;
	way[1] = 1;
	way[2] = 2;
	way[3] = 4;
	for(int i=4;i<=30;i++){
		way[i] = way[i-1]+way[i-2]+way[i-3];
	}

	while(cin>>n&&n){
		cout << ceil((double)way[n]/3650) << endl;
	}
}

C++: #include <iostream>
using namespace std;
int dp[8192];

void goup() {
	dp[0] = 1; dp[1] = 1; dp[2] = 2;

	for (int i = 3; i < 8192; i++) dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3];
	return;
}

int main() {
	int n;
	goup();

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

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <queue>
#include <cstring>
#include <cstdio>
#include <cmath>
#include <set>
#include <map>
#include <bitset>
using namespace std;
using ll = long long;
using itn = int;
const ll MOD = 1000000007;
const ll INF = MOD * MOD;
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; }

ll dp[100010];

int main() {

    dp[0] = 0;
    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];
    }

    int n, res;

    while(true) {

        cin >> n;
        if (n == 0) break;

        res = 0;

        res = dp[n] / 3650;
        if (dp[n] % 3650 > 0) res++;

        cout << res << endl;
    }

    return 0;

}

C++: #include <iostream>

using namespace std;

int main(){
  int n;

  while(1){
    int star[31] = { 0 };
    cin >> n;
    if(n == 0) break;
    star[0] = 1;

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

  return 0;
}

C++: #include<iostream>
using namespace std;
int main(){
  long long int step[31]={1,1,2};
  for(int i=3; i<31; i++){
    step[i] = step[i-1]+step[i-2]+step[i-3];
  }
  int n;
  while(cin >>n,n){
    cout <<(step[n]+3649)/3650<<endl;
  }
}

C++: #include <iostream>
#include <vector>
#include <queue>
#include <stack>
#include <string>
#include <functional>
#include <algorithm>
using namespace std;

typedef long long ll;

ll days[31];

int main()
{
    int n;
    days[0] = 1;
    days[1] = 1;
    days[2] = 2;
    for(int i = 3; i < 31; i++) {
        days[i] = days[i - 1] + days[i - 2] + days[i - 3];
    }
    
    while(cin >> n && n) {
        ll year = days[n] / 3650;
        if((days[n] % 3650) > 0) {
            year++;
        }
        cout << year << endl;
    }
}

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

int limit;
int dfs( int n )
{
	if ( n == limit ) return 1;
	if ( n > limit ) return 0;
	int count = 0;
	for ( int i = 1; i <= 3; i++ )
	{
		count += dfs( n+i );
	}
	return count;
}

int calc( int n )
{
	limit = n;
	int count = dfs( 0 );
	return count / 10;
}

int calc2( int n )
{
	vector <int> dp(n+4,0);
	dp[1] = dp[2] = dp[3] = 1;
	for ( int i = 1; i <= n; i++ )
	{
		for ( int j = 1; j <= 3; j++ ) dp[i+j] += dp[i];
	}
	return dp[n] / 10;
}

int main( void )
{
	int n;
	while ( cin >> n && n )
	{
		int days = calc2( n );
		cout << days/365+1 << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int main(void){
    int n;
    cin >> n;
    while(n!=0){
        int a[31]={};
        a[1] = 1;
        a[2] = 2;
        a[3] = 4;
        for(int i=4;i<31;i++){
            a[i] = a[i-1] + a[i-2] + a[i-3];
        }
        cout << ((a[n]/10)/365)+1 << endl;
        cin >> n;
    }
}

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

int main(void)
{
	int n;
	while(cin >> n && n)
	{
		vector<int> dp(n + 5);
		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];
		}
		int days = max(dp[n] / 10, 1);
		cout << (days / 365 + !!(days % 365)) << endl;
	}
	return 0;
}

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

using namespace std;

#define MAX_N 30
int dp[MAX_N + 1];
bool checked[MAX_N + 1];
//??\???

int count(int n) {

  if ( n == 1 ) return 1;
  if ( n == 2 ) return 2;
  if ( n == 3 ) return 4;

  if(checked[n] == true){
    return dp[n];
  } else {
    checked[n] = true;
    return dp[n] = count(n-1) + count(n-2) + count(n-3);
  }

}

int main() {

  ios::sync_with_stdio(false);

  int n, years;
  while(cin >> n) {
    if (n==0) break;
    int c = count(n);
    years = ( c / 3650 ) + (c % 3650 == 0 ? 0 : 1);
    cout << years << endl;
  }

  return 0;
}

C++: #include <iostream>
using namespace std;
int f(int n){
  if(n<0)return 0;
  if(n==0)return 1;
  return f(n-1)+f(n-2)+f(n-3);
}
int main(){
  int n;cin >> n;
      while(1){
        cin >> n;
        if(n==0)
            break;
        int num=f(n);
        cout <<num/10/365+1<< endl;
    }
}

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

long long step[40];

void count() {
  step[0] = 1;
  step[1] = 1;
  step[2] = 2;
  for(int i = 3; i < 40; i++) {
    step[i] = step[i-1] + step[i-2] + step[i-3];
  }
}

int main() {
  int n;
  count();
  while(cin >> n, n) {
    int ans = step[n]/3650 + 1;
    cout << ans << endl;
  }
}

C++: #include <iostream>
#include <cstdio>
#include <algorithm>
#include <functional>
#include <vector>
#include <string>
#include <cstring>

#define rep(i,n) for(int i=0;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define repn(i,n,m) for(int i=n;i<m;i++)
#define repn1(i,n,m) for(int i=n;i<=m;i++)
using namespace std;

int main(){

	int dp[100] = {0};
	int n;
	
	dp[1] = 1;
	dp[2] = 2;
	dp[3] = 4;

	repn(i, 4, 30) dp[i] = dp[i-1] + dp[i-2] + dp[i-3];

	while(cin >> n, n){

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

	return 0;
}

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