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 <iostream>
#include <utility>
#include <algorithm>
#include <string>
#include <deque>
#include <queue>
#include <tuple>
#include <queue>
#include <functional>
#include <cmath>
#include <iomanip>
#include <map>
#include <set>
#include <numeric>
#include <unordered_map>
#include <unordered_set>
#include <complex>
#include <iterator>
#include <array>
#include <memory>
#include <stack>
#define vi vector<int>
#define vvi vector<vector<int> >
#define ll long long int
#define vl vector<ll>
#define vvl vector<vector<ll>>
#define vb vector<bool>
#define vc vector<char>
#define vs vector<string>
#define ld long double
#define INF 1e9
#define EPS 0.0000000001
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define all(in) in.begin(), in.end()
template<class T, class S> bool cmin(T &a, const S &b) { if (a > b){a = b; return true;}return false; }
template<class T, class S> bool cmax(T &a, const S &b) { if (a < b){a = b; return true;}return false;}
#define MAX 9999999
using namespace std;
typedef pair<int, int> pii;
typedef pair<double,double>pdd;
typedef pair<ll,ll>pll;
int main(){
    int n;
    while(cin>>n,n){
        vector<ll>dp(300,0);
        dp[1]=1;
        dp[2]=2;
        dp[3]=4;
        ll ans=0;
        for(int i=1;i<=n;i++){
            if(i>=4)dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
        }
        ans=dp[n];
        cout<<ans/3650+(ans%3650?1:0)<<endl;
    }
}

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

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

#define rep(i,n) for(int i=0; i<(n); i++)
typedef long long ll;

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

C++: #include <iostream>
using namespace std;
typedef long long ll;
ll dp[35];
int main(void){
    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];
       dp[i]=(dp[i]+9)/10;
   }
    while(1){
        int n;
        cin>>n;
        if(n==0)break;
        cout<<(dp[n]+364)/365<<endl;
    }
}

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

int main(){
        
    vector<int> dp(35,0);

    dp[0] = 1;

    for(int i=0; i<=30; i++){
        for(int j=1; j<=3; j++){
            dp[i+j] += dp[i];
        }
    }

    while(1){
        int N;
        cin>>N;
        if(N == 0) break;
        cout<<(dp[N]+365*10-1)/(365*10)<<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 <string.h>

using namespace std;

int main()
{
	int dp[31];

	memset(dp, 0, sizeof(dp));

	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]; }


	const int DATASETS = 1000;

	int n[DATASETS], C = 0;


	while (true)
	{
		cin >> n[C];

		if (n[C] == 0){ goto Exit; }

		C++;
	}

Exit:;

	for (int i = 0; i < C; i++)
	{
		cout << (dp[n[i]] - 1) / 3650 + 1 << endl;
	}

	return 0;
}

C++: #include <iostream>

using namespace std;

typedef long long ll;

int main() {
	int n;
	while ( cin >> n, n ) {
		ll dp[50] = {1};
		for (int i = 0; i < n; ++i) {
			for (int j = 1; j <= 3; ++j) {
				dp[i+j] += dp[i];
			}
		}

		ll day = (dp[n] + 9) / 10;
		ll year = (day + 364) / 365;
		cout << year << endl;
	}
	
}

C++: #include <iostream>

int n;
int cmb;
int dp[30];

int func(int now){
  if(now > n)
    return 0;
  if(now == n){
    dp[now] = 1;
    return 1;
  }


  return func(now+1) + func(now+2) + func(now+3);
}

int main(void){
  while(1){
    int ans;
    std::cin >> n;

    for(int i=0; i < 30; i++){
      dp[i] = -1;
    }

    if(n == 0){
      return 0;
    }

    cmb = 0;
    ans = func(0);

    std::cout << ans / 10 / 365 + 1 << std::endl;
  }
}

C++: #define _USE_MATH_DEFINES
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <ctime>
#include <cassert>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <complex>
#include <stack>
#include <queue>
#include <numeric>
#include <list>
#include <iomanip>
#include <iterator>
 
using namespace std;
 
typedef long long ll;
typedef pair<int,int> Pii;
typedef pair<ll,ll> Pll;
 
#define FOR(i,n) for(int i = 0; i < (n); i++)
#define sz(c) ((int)c.size())

typedef unsigned long long ull;
const int INF = (int)1e8;


int main(){
	int dp[31];
	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] + 3649) / 3650 << endl;
	}

	return 0;
}

C++: #include <bits/stdc++.h>
#define rep(i, n) for (int i = 0; i < (n); i++)
#define shosu(n) setprecision(n)
#define INF 999999999
using namespace std;
int main() {
  int a, kai[31];
  kai[0] = 1;
  kai[1] = 1;
  kai[2] = 2;
  for (int i = 3; i <= 31; i++) {
    kai[i] = kai[i - 1] + kai[i - 2] + kai[i - 3];
  }
  rep(i, 30) kai[i] = (kai[i] + 3659) / 3650;
  while (cin >> a, a)
    cout << kai[a] << endl;
  return 0;
}

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 + !!(dp[n] / 10 % 365)) << endl;
	}
	return 0;
}

C++: #include <algorithm>
#include <vector>
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
    vector<int> dp(30,0);
    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];
    }
    for(;;){
        int n;
        cin >> n;
        if(n==0) break;
        int ans = dp[n]/(365*10);
        if(dp[n]%365>0) ans++;
        cout << ans << endl;
    }
    return 0;
}

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

int main() {
  int a[31]={};
  for(int i=0; i<31; i++) {
    if(i==0 || i==1) a[i]=1;
    else if(i==2) a[i]=2;
    else a[i]=a[i-1]+a[i-2]+a[i-3];
  }

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