Go: package main

import (
	"bufio"
	"fmt"
	"os"
	"strconv"
	"strings"
)

func main() {
	io := NewIo()
	defer io.Flush()
	for {
		N, K, S := io.NextInt(), io.NextInt(), io.NextInt()
		if N == 0 {
			break
		}
		dp := [21][11][156]int{}
		for i := 0; i <= N; i++ {
			dp[i][0][0] = 1
		}
		for i := 1; i <= N; i++ {
			for j := 1; j <= K; j++ {
				for k := 1; k <= S; k++ {
					if k-i >= 0 {
						dp[i][j][k] += dp[i-1][j-1][k-i]
					}
					dp[i][j][k] += dp[i-1][j][k]
				}
			}
		}
		io.Println(dp[N][K][S])
	}
}

// I/O template
type Io struct {
	reader    *bufio.Reader
	writer    *bufio.Writer
	tokens    []string
	nextToken int
}

func NewIo() *Io {
	return &Io{
		reader: bufio.NewReader(os.Stdin),
		writer: bufio.NewWriter(os.Stdout),
	}
}

func (io *Io) Flush() {
	err := io.writer.Flush()
	if err != nil {
		panic(err)
	}
}

func (io *Io) NextLine() string {
	var buff []byte
	for {
		line, isPrefix, err := io.reader.ReadLine()
		if err != nil {
			panic(err)
		}
		buff = append(buff, line...)
		if !isPrefix {
			break
		}
	}
	return string(buff)
}

func (io *Io) Next() string {
	for io.nextToken >= len(io.tokens) {
		line := io.NextLine()
		io.tokens = strings.Fields(line)
		io.nextToken = 0
	}
	s := io.tokens[io.nextToken]
	io.nextToken++
	return s
}

func (io *Io) NextInt() int {
	i, err := strconv.Atoi(io.Next())
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) NextFloat() float64 {
	i, err := strconv.ParseFloat(io.Next(), 64)
	if err != nil {
		panic(err)
	}
	return i
}

func (io *Io) Println(a ...interface{}) {
	fmt.Fprintln(io.writer, a...)
}

func (io *Io) Printf(format string, a ...interface{}) {
	fmt.Fprintf(io.writer, format, a...)
}

func (io *Io) PrintIntSlice(a []int) {
	b := make([]interface{}, 0, len(a))
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func (io *Io) PrintStringSlice(a []string) {
	b := make([]interface{}, 0, len(a))
	for _, x := range a {
		b = append(b, x)
	}
	io.Println(b...)
}

func Log(name string, value interface{}) {
	fmt.Fprintf(os.Stderr, "%s=%+v\n", name, value)
}

func ExampleIo() {
	io := NewIo()
	defer io.Flush()
	a := make([]int, 0, 3)
	a[0], a[1], a[2] = io.NextInt(), io.NextInt(), io.NextInt()
	io.Println(a)
	io.PrintIntSlice(a)
	Log("io", a)
}

C++: #include "bits/stdc++.h"
#define REP(i,a,b) for(i=a;i<b;++i)
#define rep(i,n) REP(i,0,n)
#define ll long long
#define ull unsigned ll
typedef long double ld;
#define SQR(X)  ( (X)*(X) )
#define CUBE(X) ( (X)*(X)*(X) )
#define ALL(a) (a).begin(),(a).end()
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;
 
 
void reader(int &a){scanf("%d",&a);}
void reader(double &a){scanf("%lf",&a);}
void reader(char &a){scanf(" %c",&a);}
void reader(char a[]){scanf("%s",a);}
void reader(ll &a){scanf("%lld",&a);}
void reader(ull &a){scanf("%llu",&a);}
// void reader(string& a){cin >> a;};
template<class T,class U> void reader(T& t,U& u){reader(t); reader(u);}
template<class T,class U,class V> void reader(T& t,U& u,V& v){reader(t); reader(u); reader(v);}
 
void writer(int a,char c) {printf("%d",a); putchar(c);}
void writer(ll a,char c) {printf("%lld",a); putchar(c);}
void writer(double a,char c) {printf("%.20lf",a); putchar(c);}
void writer(char a[]) {printf("%s",a);};
void writer(char a[],char c) {printf("%s",a);putchar(c);};
void writer(char a,char c) {putchar(a); putchar(c);};
template<class T>void writerLn(T t){writer(t,'\n');}
template<class T,class U>void writerLn(T t,U u){writer(t,' ');writer(u,'\n');}
template<class T,class U,class V> void writerLn(T t,U u,V v){writer(t,' ');writer(u,' ');writer(v,'\n');}
template<class T> void writerArr(T x[], int n){int i;if(!n){putchar('\n');return;}rep(i,n-1) writer(x[i],' ');writer(x[n-1],'\n');}
template<class T> void writerVec(vector<T> x){int n=x.size();int i;if(!n){putchar('\n');return;}rep(i,n-1) writer(x[i],' ');writer(x[n-1],'\n');}
 
vector<std::string> split(const std::string &str, char sep){std::vector<std::string> v;std::stringstream ss(str);std::string buffer;while(std::getline(ss,buffer,sep)){v.push_back(buffer);}return v;}
 
// #define int ll
bool test = true;
int dx[] = { 0,0,1,-1 };
int dy[] = { 1,-1,0,0 };
ull mod = (int)1e9 + 7;
//..................
int H;
#define MAX (int)1e7
// nはまだ摂取してない
ull dp[10][180][21];
signed main(){
  int i,j,k,l;
  while(1) {
	int N,K,S;
	cin >> N >> K >> S;
	if(N == 0) return 0;
	rep(i,10) rep(j,180) rep(k,21) dp[i][j][k] = 0;
	REP(i,1,N+1) dp[0][i][i] = 1;
	REP(i,1,K) rep(j,S) rep(k,N+1) {
	  REP(l,k+1,N+1) {
		dp[i][j+l][max(k,l)] += dp[i-1][j][k];
	  }
	}
	int sum = 0;
	rep(i,N+1) sum += dp[K-1][S][i];
	cout << sum << endl;
  }
  return 0;
}

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

int sum;
void ans(int n,int k,int s)
{
  s-=n;
  if(s==0 && k==1)sum++;
  if(s<=0 || k==0)return;
  for(int i=n-1;i>0;i--){
    ans(i,k-1,s);
  }
}

int main()
{
  int n,k,s;

  while(1){
    cin>>n>>k>>s;
    if(n==0&&k==0&&s==0)break;
    sum=0;
    for(int i=n;i>0;i--){
      ans(i,k,s);
    }
    cout<<sum<<endl;
  }
  return 0;
}

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

int main() {
  for(int n, k, s; cin >> n >> k >> s && (n|k|s);) {
    int res = 0;
    for(int b = 0; b < (1<<n); ++b) {
      int sum = 0, num = 0;
      for(int i = 0; i < n; ++i) {
        if(b >> i & 1) {
          sum += i+1;
          num += 1;
        }
      }
      res += (sum == s && num == k);
    }
    cout << res << endl;
  }
  return 0;
}

C++: // compile in C++11. use -std=c++11.
#include <iostream>
#include <iomanip>
#include <vector>
#include <valarray>
#include <map>
#include <set>
#include <list>
#include <queue>
#include <stack>
#include <bitset>
#include <utility>
#include <numeric>
#include <algorithm>
#include <functional>
#include <complex>
#include <string>
#include <sstream>

#include <cstdio>
#include <cstdlib>
#include <cctype>
#include <cstring>

// these require C++11
#include <unordered_set>
#include <unordered_map>
#include <random>

using namespace std;

#define int long long

#define all(c) c.begin(), c.end()
#define repeat(i, n) for (int i = 0; i < static_cast<int>(n); i++)
#define debug(x) #x << "=" << (x) << " "

#ifdef DEBUG
#define dump(x) std::cerr << debug(x) << " (L:" << __LINE__ << ")" << std::endl
#else
#define dump(x) 
#endif

typedef complex<double> point;
template<typename T,std::size_t N>
struct _v_traits {using type = std::vector<typename _v_traits<T,N-1>::type>;};
template<typename T>
struct _v_traits<T,1> {using type = std::vector<T>;};
template<typename T,std::size_t N=1>
using vec = typename _v_traits<T,N>::type;
template <typename T>
ostream &operator<<(ostream &os, const vector<T> &vec) {
    os << "[";
    for (const auto &v : vec) {
        os << v << ",";
    }
    os << "]";
    return os;
}

int dfs(int upper,int want,int rest,int greater_than,vec<int,3>& memo){
    if(memo[want][rest][greater_than] != -1){
        return memo[want][rest][greater_than];
    }
    if(rest == 1){
        return greater_than <= want and want <= upper;
    }
    int ret = 0;
    for(int i=greater_than;i<=min(upper,want);i++){
        ret += dfs(upper,want-i,rest-1,i+1,memo);
    }
    return memo[want][rest][greater_than] = ret;
}

int solve(int n,int k,int s){
    vec<int,3> memo(s+1,vec<int,2>(k+1,vec<int>(n+2,-1)));
    return dfs(n,s,k,1,memo);
}

signed main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    while(true){
        int n,k,s;
        cin >> n >> k >> s;
        if(n == 0 and k == 0 and s == 0) return 0;
        cout << solve(n,k,s) << endl;
    }
    return 0;
}

C++: #include <bits/stdc++.h>
#define REP(i, a, n) for(ll i = ((ll) a); i < ((ll) n); i++)
using namespace std;
typedef long long ll;

ll N, M, S;

ll dfs(ll n, ll m, ll s) {
  if(s > S) return 0;
  if(m == M) return s == S;

  ll ret = 0;
  REP(i, n, N + 1) ret += dfs(i + 1, m + 1, s + i);
  return ret;
}

int main(void) {
  while(cin >> N >> M >> S, N && M && S) cout << dfs(1, 0, 0) << endl;
}