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 A[40];

int main(void) {
	int n;
	while(cin >> n && n) {
		for (int i = 0; i <= n; i++) {
			if (i == 0) A[i] = 1;
			else if (i == 1) A[i] = 1;
			else if (i == 2) A[i] = 2;
			else A[i] = A[i-3] + A[i-2] + A[i-1];
		}
		int ans;
		if (A[n] % 3650 == 0) ans = A[n] / 3650;
		else ans = A[n] / 3650 + 1;
		cout << "\n" << ans;
	}

	return 0;
}

C++: #include<bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    int dp[31]={};
    dp[0]=1;dp[1]=1;dp[2]=2;
    for(int i=3;i<31;i++){
        for(int j=1;j<4;j++){
            dp[i]+=dp[i-j];
        }
    }
    while(cin>>n,n){
        int num=dp[n]/3650;
        if(dp[n]%3650!=0)num++;
        cout<<num<<endl;
    }
}

C++: #include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using namespace std;

using ll = long long;

int main(void){
  vector<int> stairs;
  int input;
  do{
    cin >> input;
    if(input!=0) stairs.push_back(input);
  }while(input!=0);

  rep(i,stairs.size()){
    int max_step = stairs[i];
    vector<int> dp(max_step+1,-10);
    if(max_step<=4){
      cout << "1" << endl;
      continue;
    }
    
    dp.at(max_step) = 1;
    dp[max_step-1] = 1;
    dp[max_step-2] = 2;
    dp[max_step-3] = 4;
    for(int j=max_step-2;j>=0;j--){
      if(j+3<=max_step) dp.at(j) = dp.at(j+1)+dp.at(j+2)+dp.at(j+3);
    }
    ll day = dp[0]/10;
    ll ans;
    if(day%365==0) ans = day/365;
    else ans = day/365+1;
    cout << ans << endl;
  }
  
  return 0;
}

C++: #include<iostream>

long long int a[30];

int main(){
	int n;
	while (std::cin >> n){
		a[0] = 0, a[1] = 1, a[2] = 4;
		for (int i = 3; i <= n; ++i){
			a[i] = a[i - 1] + a[i - 2] + a[i - 3];
		}
		std::cout << (a[n]/3650)+1 << std::endl;
	}
}

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

int main(void)
{
	int n;
	while(cin >> n && n)
	{
		vector<int> dp(n + 5);
		dp[0] = 1;
		for (int i = 0; i < n; i++)
		{
			dp[i + 1] += dp[i];
			dp[i + 2] += dp[i];
			dp[i + 3] += dp[i];
		}
		cout << (dp[n] / 365 + !!(dp[n] % 365)) << endl;
	}
	return 0;
}

C++: #include <iostream>
using namespace std;
int n;
long long int d,c,day,ans;

long long solve(int d){
    if(d == 0) return 1;
    if(d < 0) return 0;
    c = solve(d-1) + solve(d-2) + solve(d-3);
    return c;
}

int main(void){
    // Your code here!
    while(cin >> n&&n){
        cout << solve(n)/3650 + 1 << 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, 31) kai[i] = (kai[i] + 3649) / 3650;
  while (cin >> a, a)
    cout << kai[a] << endl;
  return 0;
}

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

int f(int n){
   if(n == 1)return 1;
   if(n == 2)return 2;
   if(n == 3)return 4;
   return f(n-1) + f(n-2) +f(n-3);
}

int main(void){
   while(true){
       int n;
       cin >> n;
       if(n==0)break;
       cout << (f(n) / 3650)+1 << endl;
   }
}

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

int main() {
    int a[100]={0};
    a[0]=1;
    a[1]=1;
    a[2]=2;
    int n;
    int x;
    while(cin >>n){
    x=0;
    for(int i=3;i<n;i++){
    	a[i]=a[i-3]+a[i-2]+a[i-1];
    }
    x=a[n]%3650;
    x=x+1;
    cout << x;
    
    }
	return 0;
}

C++: #include <iostream>
#include <sstream>
#include <iomanip>
#include <algorithm>
#include <cmath>
#include <string>
#include <vector>
#include <list>
#include <queue>
#include <stack>
#include <set>
#include <map>
#include <bitset>
#include <numeric>
#include <climits>
#include <cfloat>
using namespace std;

int main()
{
    for(;;){
        int n;
        cin >> n;
        if(n == 0)
            return 0;

        vector<int> num(n+3, 0);
        num[0] = 1;
        for(int i=0; i<n; ++i){
            num[i+1] += num[i];
            num[i+2] += num[i];
            num[i+3] += num[i];
        }

        int ret = num[n];
        cout << ((num[n]+3649) / 3650) << endl;
    }
}

C++: #include<iostream>
using namespace std;
int F[30];
int N;
int main()
{
    F[0]=1;
    F[1]=F[0];
    F[2]=F[1]+F[0];
    for(int i=3;i<=30;i++)
    {
        F[i]=F[i-1]+F[i-2]+F[i-3];
    }
    while(cin>>N&&N)
    {
        cout<<((F[N]+9)/10+364)/365<<endl;
    }
}

C++: #include <iostream>
#include <stdio.h>
#include <vector>
#include <string>
#include <algorithm>
using namespace std;


int dp[34];
int main(){
int N,x;

  cin >> x;
  dp[0] = 1;
  for(int i = 0; i < 31; i++){

	  dp[i+1] += dp[i];
	  dp[i+2] += dp[i];
	  dp[i+3] += dp[i];

  }

  while(x != 0){

	  cout << dp[x]/3650 + 1 << endl;;

	  cin >> x;
  }


    


	return 0;
}

C++: #include <iostream>
using namespace std;
int n;
int saiki(int ima)
{
	if(ima == n)
		return 1;
	if(ima > n)
		return 0;

	int res = 0;
	res += saiki(ima + 1) + saiki(ima + 2) + saiki(ima + 3);
	return res;
}

int main() {
	while (true){
		cin >> n;
		if (n == 0)
			break;
		
		int ans,a;
		ans = saiki(0);
		a = ans;
		ans /= 3650;
		a %= 3650;
		if( a == 0 )
		{
			cout << ans << endl;
		}
		else if( a != 0 )
		{
			ans++;
			cout << ans << endl;
			
		}
	}
}

C++: #include <vector>
#include <map>
#include <set>
#include <stack>
#include <queue>
#include <algorithm>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <string>
#include <cstring>
#include <complex>
#include <ctime>
#include <cstdlib>

using namespace std;

inline int to_int(string s) {int v; istringstream sin(s); sin >> v; return v;}
template<class T> inline string to_str(T x) {ostringstream sout; sout << x; return sout.str();}

typedef long long ll;

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

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

#define rep(i,j) for(int (i)=0;(i)<(int)(j);++(i))

int a[300], n;

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

    while (cin >> n, n) {
        if (a[n]%3650 == 0) cout << a[n]/3650 << endl;
        else cout << a[n]/3650+1 << endl;
    }
}

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

using namespace std;

int main() {
	int n;
	while (cin >> n) {
		if (n == 0) {
			break;
		}
		vector<int> dp(31, 0);
		dp[0] = 1;
		dp[1] = 1;
		dp[2] = 2;
		for (int j = 3; j <= n; j++) {
			dp[j] = dp[j-1]+dp[j-2]+dp[j-3];
		}
		int y = dp[n]/3650;
		if (dp[n] % 3650 > 0) {
			y++;
		}
		cout << y << endl;
	}
	return 0;
}

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

int n;
int a[31];

int main()
{
	a[0] = 1;
	a[1] = 1;
	a[2] = 2;

	for( int i = 3; i <= 30; ++i )
		a[i] = a[i-1] + a[i-2] + a[i-3];

	while( std::cin >> n, n )
		std::cout << ceil( a[n] / 10.0 / 365.0 ) << std::endl;

	return 0;
}