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>
using namespace std;

int dp[31];

int main() {
	int n;
	cin >> n;
	
	dp[1] = 1;
	dp[2] = 2;
	dp[3] = 4;
	for(int i = 4; i <= n; i++)
		dp[i] = dp[i - 1] + dp[i - 2] + dp[i - 3];
		
	int ans = (dp[n] / 3650 == 0) ? dp[n] /3650 : dp[n] / 3650 + 1;
	
	cout << ans << endl;
	return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <cmath>
using namespace std;
#define ll long long
#define REP(i,n) for(int i=0;i<n;i++)
#define PP(m) REP(i, m.size()) cout << m[i] << endl;

int main() {
  vector<long long> dp(31);
  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 << ceil(dp[n] / 3650) + 1 << endl;
  }
  return 0;
}

C++: #include<bits/stdc++.h>
typedef long long ll;
#define sz(x) int(x.size())
#define rep(i,n) for(int i = 0; i < (n); ++i)
#define MOD 1000000007
using namespace std;


int main(){
    int n;
    int dp[31] = {0};
    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];
    }
    
    while(true){
        cin >> n;
        if(n == 0) break;
        int day = (dp[n]-1)/10 + 1;
        int year = (day-1)/365 + 1;
        cout << year << endl;
    }
    return 0;
}

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

vector<long long int>D;

int main() {
	long long int N;
	D.push_back( 1 );
	D.push_back( 1 );
	D.push_back( 2 );
	D.push_back( 4 );
	while( cin >> N, N ) {
		while( D.size() <= N ) {
			D.push_back( D[D.size() - 1] + D[D.size() - 2] + D[D.size() - 3] );
		}
		cout << D[N] / 3650 + 1 << endl;
	}
}

C++: #include <cstdlib>
#include <cmath>
#include <climits>
#include <cfloat>
#include <map>
#include <utility>
#include <set>
#include <iostream>
#include <memory>
#include <string>
#include <vector>
#include <algorithm>
#include <functional>
#include <sstream>
#include <deque>
#include <complex>
#include <stack>
#include <queue>
#include <cstdio>
#include <cctype>
#include <cstring>
#include <ctime>
#include <iterator>
#include <bitset>
#include <numeric>
#include <list>
#include <iomanip>

#if __cplusplus >= 201103L
#include <array>
#include <tuple>
#include <initializer_list>
#include <unordered_set>
#include <unordered_map>
#include <forward_list>

#define cauto const auto&
#else

#endif

using namespace std;


namespace{
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;

typedef vector<int> vint;
typedef vector<vector<int> > vvint;
typedef vector<long long> vll, vLL;
typedef vector<vector<long long> > vvll, vvLL;

#define VV(T) vector<vector< T > >

template <class T>
void initvv(vector<vector<T> > &v, int a, int b, const T &t = T()){
    v.assign(a, vector<T>(b, t));
}

template <class F, class T>
void convert(const F &f, T &t){
    stringstream ss;
    ss << f;
    ss >> t;
}


#define reep(i,a,b) for(int i=(a);i<(b);++i)
#define rep(i,n) reep((i),0,(n))
#define ALL(v) (v).begin(),(v).end()
#define PB push_back
#define F first
#define S second
#define mkp make_pair
#define RALL(v) (v).rbegin(),(v).rend()


#define MOD 1000000007LL
#define EPS 1e-8
static const int INF=1<<24;
ll dp[31];
void mainmain(){
	dp[1]=1;
	dp[2]=2;
	dp[3]=4;
	reep(i,4,31){
		rep(j,3){
			dp[i]+=dp[i-j-1];
		}
	}
	// reep(i,4,7){
		// cout<<dp[i]<<endl;
	// }
	// rep(i,35){
		// cout<<i<<" "<<i*3650<<endl;
	// }
	int n;
	while(cin>>n){
		ll t=dp[n]-1;
		// cout<<t<<endl;
		t/=3650;
		cout<<t+1<<endl;
	}
}



}
main() try{
    mainmain();
}
catch(...){
}

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

long dp[31];

int main(){
	int n;
	dp[0] = 1;
	for(int i = 0; i <= 30; i++) {
		for(int j = 1; j <= 3; j++) {
			if(i+j <= 30) dp[i+j] += dp[i];
		}
	}
	while(1) {
		scanf("%d", &n);
		if(n == 0) break;
		printf("%ld\n", dp[n]/3650+1);
	}
}

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

const int kMaxJumpStep = 3;

int dp(const int N){
	std::vector<int> step(N+1);
	step[0] = 1;

	for (int i = 0; i <= N; i++){
		for (int j = i + 1; j <= i + kMaxJumpStep; j++){
			if (j > N) break;
			step[j] += step[i];
		}
	}

	return step[N];
}

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

	while (1){
		int n;
		std::cin >> n;
		if (n == 0) break;
		std::cout << dp(n)/3650 + 1 << std::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; }

//kannondou??¨??¢?´¢
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 << solve(n) / 3650 + 1 << endl;
	}
}

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

int main() {
	int n, num[30];
	num[0] = 1;
	num[1] = 2;
	num[2] = 4;
	for (int i = 3; i < 30; i++) num[i] = num[i - 3] + num[i - 2] + num[i - 1];
	while (cin >> n,n) {
		cout << (int)ceil((double)num[n - 1] / 3650.0) << endl;
	}
	return 0;
}