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 = [0] * (n + 1)
    dp[0] = 1
    if n <= 3:
        print(1)
    else:
        dp[1] = 1
        dp[2] = 2
        for i in range(3, n + 1):
            dp[i] = dp[i - 3] + dp[i - 2] + dp[i - 1]
        print(dp[-1] // (365 * 10) + 1)

Python: import sys,math
a=list(map(int,sys.stdin.read().split()))
a.pop(-1)

for n in a:
  dp=[0]*35
  dp[0]=1
  for i in range(n+1):
    for j in [+1,+2,+3]:
      dp[i+j]+=dp[i]
  print(math.ceil(dp[n]/3650))

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

Python: import math
a = []
while True:
    ai = int(input())
    if ai == 0:
        break
    a.append(ai)
for i in range(len(a)):
    dp = [0] * (a[i] + 10)
    dp[0] = 1
    dp[1] = 1
    dp[2] = 2
    for j in range(3, a[i] + 1):
        dp[j] = dp[j - 1] + dp[j - 2] + dp[j - 3]
    #print(dp)
    print(math.ceil(dp[a[i]] / 3650))

Python: import math
 
ans = [0 for i in range(31)]
ans[0] = 1
ans[1] = 1
ans[2] = 2
for i in range(3, 31):
    ans[i] = ans[i-1] + ans[i-2] + ans[i-3]
 
while True:
    N = int(input())
    if N == 0:
        break
 
    print(math.ceil(ans[N]/3650))

Python: import functools


@functools.lru_cache(maxsize=None)
def rec(i):
    if i <= 0:
        return i == 0
    return rec(i-1) + rec(i-2) + rec(i-3)

while True:
    N = int(input())
    if not N:
        break
    print(rec(N)//3650+1)

Python: b=True
l=[1,1,2,4]
def year(n):
  if n%3650==0:
    return n//3650
  else:
    return n//3650+1
while b==True:
  n=int(input())
  if n==0:
    b=False
    break
  else:
    if len(l)>n:
      pass
    else:
      while len(l)!=1+n:
        l.append(l[-1]+l[-2]+l[-3])
    print(year(l[n]))

Python: from math import ceil

a = [0, 1, 2, 4] # n = 0 ??? 3 ????????§??°??????
while True:
    n = int(input())
    if n == 0:
        break
    for i in range(len(a), n+1):
        a.append(a[-3] + a[-2] + a[-1])
    print( int(ceil(a[n]/3650)) )

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

Python: # -*- coding: utf-8 -*-
"""
http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=0168

"""
import sys
from sys import stdin
from math import ceil
input = stdin.readline


def solve(n):
    dp = [[0] * (n+1) for _ in range(n+1)]
    dp[0][0] = 1

    for i in range(1, n+1):
        for j in range(i, n+1):
            t = 0
            for k in range(1, min(j+1, 3+1)):
                t += dp[i-1][j-k]
            dp[i][j] = t

    total = 0
    for d in dp:
        total += d[-1]
    return total


def main(args):
    while True:
        n = int(input())
        if n == 0:
            break

        result = solve(n)
        print(ceil(result / 365 / 10))


if __name__ == '__main__':
    main(sys.argv[1:])

Python: import math
N = []
while 1:
    n = int(input())
    if n == 0:
        break
    N.append(n)
# print(N)

for n in N:
    dp = [0]*(n+5)
    dp[0] = 1
    for i in range(n):
        dp[i+1] += dp[i]
        dp[i+2] += dp[i]
        dp[i+3] += dp[i]
    print(math.ceil(dp[n]/3650))

Python: def fib(n):
    n=int(n)
    F=[1,1,2]
    if n>=3:
        for j in range(2,n):
            F.append(F[j-2]+F[j-1]+F[j])
    return F[n]
                
for i in range(30):
    a=input(int())
    if a==0:
        break
    else:
        print(-((-fib(a)//10)//365))
    
    
    
#https://python.ms/sub/misc/division/を参考にしました

Python: while True:
    n = int(input().strip())
    if n == 0:
        break
    elif n == 1:
        print(1)
    elif n == 2:
        print(2)
    else:
        lst = [0 for i in range(0,n+1)]
        lst[0] = 1
        lst[1] = 1
        lst[2] = 2
        for i in range(0,n-2):
            lst[i+3] = lst[i+2] + lst[i+1] + lst[i]
        print(lst[n])

Python: def calc_term(num,size):
  term = num // size
  if num % size != 0:
    term += 1
  return term

def main():
  ary = [0] * 40
  while True:
    n = int(input())
    if n == 0:
      break
    ary[0] = 1
    ary[1] = 1
    ary[2] = 2
    for i in range(3,n+1):
      ary[i] = ary[i-3] + ary[i-2] + ary[i-1]
    days = calc_term(ary[n],10)
    years = calc_term(days,365)
    print(years)

if __name__ == '__main__':
  main()

Python: 
def stairs(N):
    dp = [0] * (N + 5)
    dp[0] = 1
    for i in range(N + 1):
        dp[i + 1] += dp[i]
        dp[i + 2] += dp[i]
        dp[i + 3] += dp[i]

    d, v = divmod(dp[N], 10)
    days = d + 1 if v else d
    d, v = divmod(days, 365)
    years = d + 1 if v else d
    print(years)


while True:
    N = int(input())
    if N == 0:
        exit()
    stairs(N)

Python: def fib(n):
    n=int(n)
    F=[1,1,2]
    if n>=3:
        for j in range(2,n):
            F.append(F[j-2]+F[j-1]+F[j])
    return F[n]
                
for i in range(32):
    a=input(int())
    if a==0:
        break
    else:
        print(-((-fib(a)//10)//365))
    
    
    
#https://python.ms/sub/misc/division/を参考にしました

Python: from math import ceil
# トリボナッチ数列
dp = [1, 1, 2]
for i in range(3, 31):
    dp.append(dp[i-1] + dp[i-2] + dp[i-3])

while True:
    a = int(input())
    if a == 0:
        break
    print(ceil(dp[a]/10/365))

Python: def up(n):
	goal = [0 for i in range(n)]
	goal[:3] = [1,2,4]
	for i in range(3,n):
		goal[i] = sum(goal[i-3:i])
	return goal[-1]
	
while True:
	n = int(raw_input())
	if n == 0: break
	print (up(n)//10+1)//365+1

Python: 
def dpf(n):
    dp = [-1]*40
    dp[0] = 1
    dp[1] = 1
    dp[2] = 2

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

    return dp[n]

def solve(i):
    res = -1
    x = dpf(i)    
    day = (x+10-1)//10
    res = (day+365-1)//365
    return res

def main():
    a = []
    for e in iter(input, '0'):
       a.append(int(e)) 

    for i in a:
        print(solve(i))
    
main()

Python: def fib(n):
    n=int(n)
    F=[1,1,2]
    if n>=3:
        for j in range(2,n):
            F.append(F[j-2]+F[j-1]+F[j])
    return F[n]
                
a=input(int())
print(-((-fib(a)//10)//365))

Python: def stair(n) :
    if n == 1 :
        return 1
    elif n == 2 :
        return 2
    elif n == 3 :
        return 4
    elif n == 4 :
        return 7
    elif n == 5 :
        return 13
    elif n == 6 :
        return 24
    elif n == 7 :
        return 44
    elif n == 8 :
        return 81
    else :
        return stair(n-1)+stair(n-2)+stair(n-3)

while True :
    n = int(input())
    if n == 0 :
        break
    kaisu = stair(n)
    if kaisu % 10 == 0 :
        day = kaisu // 10
    else :
        day = kaisu // 10 + 1
    if day % 365 == 0 :
        year = day // 365
    else :
        year = day // 365 + 1
    print(year)

Python: while True:
  n=int(input())
  if n==0:
    break
  elif n==1 or n==2:
    print(1)
  else:
    A=[0]*(n+1)
    A[0]=1
    A[1]=1
    A[2]=2
    for i in range(3,n+1):
      A[i]=A[i-1]+A[i-2]+A[i-3]
    print(A[n]//3650+1)

Python: def fib(n):
    n=int(n)
    F=[1,1,2]
    if n>=3:
        for j in range(2,n):
            F.append(F[j-2]+F[j-1]+F[j])
    return F[n]
                
for i in range(32):
    a=input(int())
    if a==0:
        break
    else:
        print(-((-fib(a)//10)//365))
    
    
    
#https://python.ms/sub/misc/division/を参考にしました