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

Python: while True:
    n = int(input())
    if n == 0:
        break
    
    dp = [-1] * n
    
    for i in range(n):
        if i == 0:
            dp[0] = 1
        elif i == 1:
            dp[1] = 2
        elif i == 2:
            dp[2] = 4
        else:
            dp[i] = dp[i-1] + dp[i-2] + dp[i-3]
    ans = dp[-1] // 3650
    if dp[-1] % 3650 > 0:
        ans += 1
    print(ans)

Python: dp = [0] * 34
dp[0] = 1
for i in range(30):
    dp[i+1] += dp[i]
    dp[i+2] += dp[i]
    dp[i+3] += dp[i]
while True:
    n = input()
    if n == 0: break
    print(dp[n]//3650+1)

Python: #coding:utf-8
from __future__ import division,print_function
try:
    input = raw_input
    range = xrange
except NameError:
    pass
# 上記のコードはPython2とPython3の違いを一部吸収するためのもの

# def solve(n):
# n : 段数(整数)
# 出力: 一郎君がすべての上り方を実行するのに必要な年数をprintする。
a=[0]*100
def solve(n):
    # ここに問題を解くプログラムをかく。s(4)==s(1)*4+s(2)*2+s(3)*1
    if n==1:
        a[1]=1
        return 1
    elif n==2:
        a[2]=2
        return 2
    elif n==3:
        a[3]=4
        return 4
    elif a[n]!=0:
        return a[n]
    else:
        a[n]=solve(n-3)+solve(n-2)+solve(n-1)
        return a[n]
    

def main():
    while True:
        inp=int(input())
        if inp==0:
            break
        print(solve(inp)//3650+1)

main()

Python: import sys
if sys.version_info[0]>=3: raw_input=input
a=[1,1,2]
for i in range(3,31): a.append(a[i-1]+a[i-2]+a[i-3])
while True:
	n=int(raw_input())
	if n==0: break
	print((a[n]+3649)//3650)

Python: def solve():
    ans = []
    while True:
        n = int(input())
        if n == 0:
            break

        dp = [0] * (n+1)
        dp[0] = 1
        for i in range(1, n+1):
            dp[i] += dp[i - 1]
            if i > 1:
                dp[i] += dp[i - 2]
            if i > 2:
                dp[i] += dp[i - 3]

        ans.append((dp[-1]+3649) // 3650)
    print(*ans, sep='\n')


if __name__ == "__main__":
    solve()

Python: def nob(n):
    nob_h=[n+1]

    for i in range(n+1):
        if i==0 or i==1:
            nob_h.append(1)
        elif i==2:
            nob_h.append(2)
        elif i>2:
            nob_h.append(nob_h[i]+nob_h[i-1]+nob_h[i-2])


    days=int(nob_h[n+1]/10)

    year=int(days/365)+1

    print(year)

n=[]

while True:
    i=input()
    if i == "0":
        break
    n.append(i)

for i in range(len(n)):
    nob(int(n[i]))

Python: def main():
    import sys

    readline = sys.stdin.readline

    while True:
        N = int(readline().rstrip())
        if N == 0:
            break

        dp = [0] * (N + 1)
        dp[0] = 1
        
        for i in range(1, N + 1):
            if i == 1:
                dp[i] += dp[i - 1]
            elif i == 2:
                dp[i] += dp[i - 1] + dp[i - 2]
            else:
                dp[i] += dp[i - 1] + dp[i - 2] + dp[i - 3]
        print(-(-dp[-1] // 3650))


main()

Python: dp = [0] * 31
dp[0] = 1
dp[1] = 1
dp[2] = 2

for i in range(3, 31):
  dp[i] = dp[i-3] + dp[i-2] + dp[i-1]

while True:
  n = int(input())
  if n == 0:
    break
  p = dp[n] // 10 + bool(dp[n] % 10)
  print(p // 365 + bool(p % 365))

C++: #include<iostream>

using namespace std;

int main()
{
  int n;
  long long int dp[31]={1,1,2};
  for(int i=3;i<31;i++)
      dp[i]=dp[i-1]+dp[i-2]+dp[i-3];
  for(;cin>>n,n;)
    cout<<(long long int)((dp[n]/3650.0)+0.999999)<<endl;
}

C++: #include <algorithm>
#include <bitset>
#include <cassert>
#include <climits>
#include <cmath>
#include <cstdio>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iomanip>
#include <iostream>
#include <list>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <typeinfo>
#include <vector>

using namespace std;

#define ALL(x) (x).begin(), (x).end()
#define EACH(itr,c) for(__typeof((c).begin()) itr=(c).begin(); itr!=(c).end(); itr++)  
#define FOR(i,b,e) for (int i=(int)(b); i<(int)(e); i++)
#define MP(x,y) make_pair(x,y)
#define REP(i,n) for(int i=0; i<(int)(n); i++)

long long dp[31];

void init() {
  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 solve(int x) {
  int days = (dp[x] + 9) / 10;
  return (days + 364) / 365;
}

int main(int argc, char *argv[])
{
  ios::sync_with_stdio(false);
  init();
  int n;
  while (cin >> n) {
    if (!n) break;
    cout << solve(n) << endl;
  }
  
  return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
/* 変数名を被らせない
   デバッグコードを取り除く */
#define ANSWER(x) cout<<x<<endl
#define debug(x) cout<<#x<<": "<<x
const int MAX_INT = 1000000;
int n;
int solve(int a);
int main(){
  cin >> n;
  cout << (solve(n)/10+365)/365 << endl;
}
int solve(int a){
  if(a == 0)return 1;
  else if(a < 0)return 0;
  else return solve(a-1)+solve(a-2)+solve(a-3);
}

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

int main()
{
  int dp[40];
  fill_n(dp, 40, 0);

  dp[0] = 1;

  for (int i = 1; i < 40; ++i) {
    for (int j = 1; j <= 3; ++j) {
      if (i-j>=0) dp[i] += dp[i-j];
    }
  }

  int n;
  while (cin >> n) {
//     int ans = dp[n] / 3650;
//     if (dp[n] % 3650 != 0) ans++;
    int ans = 0;
    while (ans * 3650 < dp[n]) ans++;
    cout << ans << endl;
  }
}

C++: #include <bits/stdc++.h>
using namespace std;
 
int main(){
  
  vector<int> dp(30);
  dp.at(0) = 1;
  dp.at(1) = 2;
  dp.at(2) = 4;
  for(int i = 3; i < 30; i++) dp.at(i) = dp.at(i-1) + dp.at(i-2) + dp.at(i-3);

  while(true){
    
    int n; cin >> n;
    if(n == 0)  break;
    
    int res = dp.at(n-1);
    res = ( (res + 9 ) / 10  + 364) / 365;
    
    cout << res << endl;
    
  }

  return 0;
}

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

using namespace std;

struct Memo
{

  int count;

  Memo()
  {
    count = 0;
  }

};

Memo memo[31];

int ProgressNumberOfYears(int step_num)
{

  int kind_count = 0;

  if(step_num == 0) return 1;
  else if(memo[step_num].count) return memo[step_num].count;

  if(step_num - 3 >= 0)  kind_count = kind_count + ProgressNumberOfYears(step_num - 3);
  if(step_num - 2 >= 0)  kind_count = kind_count + ProgressNumberOfYears(step_num - 2);
  if(step_num - 1 >= 0)  kind_count = kind_count + ProgressNumberOfYears(step_num - 1);

  memo[step_num].count = kind_count;

  return kind_count;

}

int main()
{

  int step_num;

  while(cin >> step_num && step_num != 0) cout << ProgressNumberOfYears(step_num)/10/365 + 1<< endl;

  return 0;

}

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

#define int long long
#define endl '\n'
#define REP(i, n) for (int i = 0; i < (int)(n); ++i)
#define REPS(i, a, n) for (int i = (a); i < (int)(n); ++i)
#define RREP(i, n) for (int i = 1; i <= (int)(n); ++i)
#define pb emplace_back
#define mp make_pair
#define fi first
#define se second
#define ALL(v) v.begin(), v.end()

typedef pair<int, int> P;

inline bool inside(int y,int x,int H,int W){return(y>=0&&x>=0&&y<H&&x<W);}
inline int in() {int x; std::cin >> x; return x;}

const int MOD = 1e9 + 7;
const int INF = 1e9 + 9;
const int dx[] = {0, 1, 0, -1, 1, -1, 1, -1};
const int dy[] = {1, 0, -1, 0, 1, -1, -1, 1};

int d[50];

signed main()
{
  int n;
  while (cin >> n, n){
    memset(d, 0, sizeof(d));
    d[0] = 1;
    for (int i = 0; i < n; i++){
      for (int j = 1; j <= 3; j++){
        d[i + j] += d[i];
      }
    }

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