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 <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 <iomanip>
#include <fstream>
#include <bitset>
#include <array>

using namespace std;

#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
#define erep(i, n) for (int i = 0; i <= (int)(n); ++i)
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define clr(a, x) memset(a, x, sizeof(a))
#define sz(a) ((int)(a).size())
#define mp(a, b) make_pair(a, b)
#define ten(n) ((long long)(1e##n))

const int INF = -1;

typedef long long ll;
typedef pair<int, int> pii;

ll dp[31];
int N;

void solve() {
    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 main() {
    clr(dp, -1);
    solve();
    while (cin >> N, N) {
        cout << (dp[N]/10)/365+bool(dp[N]%365) << endl;
    }
    return 0;
}

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

typedef long long ll;

int main() {
  int n; 
  ll dp[31];
  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 ( cin >> n, n ) cout << dp[n]/365/10 + 1 << endl;
  
  return 0;
}

C++: #include <iostream>
#include <cstdio>
#include <cstdlib>
#include <time.h>
#include <math.h>
#include <vector>
#include <queue>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <sstream>
#include <string>
#include <bitset>
using namespace std;
#define FOR(I,F,N) for(int I = F; I < (int)(N); I++)
#define rep(i, n) FOR(i, 0, n)
#define FIN(V) cout<<V<<endl
#define pb push_back
#define INF (1 << 30)
typedef pair<int, int> P;
typedef long long ll;
typedef priority_queue<int> pq;
int StrToInt(string);
string IntToStr(int);
int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

int main(void){
	int n;
	//d[0] = 1patern d[1] = 1paten d[2] = 2patern
	int dp[41] = {1, 1, 2};
	for(int i = 3; i <= 31; i++){
		dp[i] = dp[i-3] + dp[i-2] + dp[i-1];
	}
	while(cin >> n)
		FIN(dp[n]/10 / 365 + 1);

	return 0;
}

C++: #include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int n;
int combination[128];

int main(){

  combination[0] = 1;
  
    for (int i = 1; i <= 32; ++i)
    {
      combination[i] = combination[i-1];
      if(i>1) combination[i] += combination[i-2];
      if(i>2) combination[i] += combination[i-3];
    }

while(cin >> n && n){
    cout << ((combination[n]+9)/10+364)/365 << endl;

  }


return 0;

}

C++: #include <bits/stdc++.h>
using namespace std;
const long long INF=1LL << 60;



int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    vector<int> dan;
    vector<int> dp(35,0);
    int N;
    for(int i=0;i<35;i++){
        int tmp;
        cin>>tmp;
        if(tmp==0) break;
        dan.push_back(tmp);        
    }
    dp[0]=1;
    for(int i=1;i<31;i++){
        dp[i]+=dp[i-1];
        if(i>1)dp[i]+=dp[i-2];
        if(i>2)dp[i]+=dp[i-3];
    }
    for(int i:dan){
        int tmp=dp[i]/3650
        if(dp[i]%3650!=0) tmp++;
        cout << tmp <<endl;
    }

    return 0;
}

C++: #include<iostream>
using namespace std;
long long int  func(long long int x){
	if(x==0)
		return 1;
	else return x*func(x-1);
}
int main(){
	long long int sum,n,k,pre,num;
	while(cin>>n,n){
		sum=0;
		for(int i=0;i<=n/3;i++)
		for(int j=0;j<=(n-3*i)/2;j++){
			k=n-3*i-2*j;
			num=i+j+k;
			cout<<i<<' '<<j<<' '<<k<<endl;
			sum+=func(num)/(func(i)*func(j)*func(k));
			
			cout<<func(num)/(func(i)*func(j)*func(k))<<' '<<sum/3650<<endl;
		}
		pre=sum%3650;
		if(pre>0)
			pre=1;
		else
		pre=0;
		cout<<sum/3650+pre<<endl;
	}
	return 0;
}

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

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

int main(void){
	const int ofDay = 10;
	const int MAXN = 30;
	const int TOBIN = 3;
	const int YEAR = 365;
	int dp[MAXN+1];
	int tobi[TOBIN] = {1,2,3};
	
	// init
	for(int i=0; i<=MAXN; i++)
		dp[i] = 0;
	dp[1] = 1;
	dp[2] = 1;
	dp[3] = 1;

	// 全通り計算
	for(int i=1; i<=MAXN-3; i++){
		for(int j=1; j<=TOBIN; j++){
			dp[i+j] += dp[i];
		}
	}

	// 年数
	for(int i=1; i<=MAXN; i++){
		dp[i] = dp[i] / ofDay / YEAR;
		dp[i] += 1;
	}

	// 対話
	while( true ){
		int n;
		if( (cin >> n) == 0 )
			break;

		cout << dp[n] << 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
#define MAX_N 100100

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

ll n;
ll dp[100];

int main() {
	dp[1] = 1;
	dp[2] = 2;
	dp[3] = 4;
	FOR(i, 4, 31) {
		dp[i] += dp[i - 1] + dp[i - 2] + dp[i - 3];
	}
	while (cin >> n&&n) {
		cout << dp[n] / 3650 + 1 << endl;
	}
}

C++: #include <iostream>

using namespace std;

int main(int argc, char const* argv[])
{
	int n;
	unsigned long long answer[31];
	
	for( int i = 0;i < 31;i++ ){
		answer[i] = 0;
	}

	answer[0] = 1;
	for( int i = 0;i < 31;i++ ){
		if( i + 3 < 31 ) answer[i + 3] += answer[i];
		if( i + 2 < 31 ) answer[i + 2] += answer[i];
		if( i + 1 < 31 ) answer[i + 1] += answer[i];
	}
	while( cin >> n && n != 0 ){
		cout << answer[n] / 3650 + 1  << endl;
	}


	return 0;
}

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

int main()
{
  int n;
  std::cin >> n;
  while (true) {
    std::vector<long long> dp(40);
    dp[0] = 1;
    for ( int now = 0; now < n; now++ ) {
      for ( int next = now + 1; next <= std::min(n, now + 3); next++ ) {
        dp[next] += dp[now];
      }
    }
    std::cout << (dp[n] + 3650 - 1) / 3650 << std::endl;
    std::cin >> n;
    if ( n == 0 ) break;
  }
  return 0;
}