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 <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
using namespace std;

int ans ;

int n,k,s;

void dfs(int id,int tot,int sum){
    if(tot>k) return;
    if(sum<s&&(s-sum<id)) return;
    if(tot==k&&sum==s){
        ans++;
        return;
    }
    if(id>n||sum>s) return;
    dfs(id+1,tot+1,sum+id);
    dfs(id+1,tot,sum);
}

int main()
{
    while(~scanf("%d%d%d",&n,&k,&s)){
        if(n==0&&k==0&&s==0) break;
        ans=0;
        dfs(1,0,0);
        printf("%d\n",ans);
    }
    return 0;
}

C++: #include <bits/stdc++.h>

using namespace std;

int main()
{
    int n, k, s;
    
    while (scanf("%d %d %d", &n, &k, &s) && n){
        int a = 0;
        
        for (int i = 0; i < 1 << n; i++){
            if (__builtin_popcount(i) != k) continue;
            int tmp = 0;
            for (int j = 0; j < n; j++){
                if (i >> j & 1) tmp += j + 1;
            }
            if (tmp == s) a++;
        }
        printf("%d\n", a);
    }
    
    return (0);
}

C++: #include <bits/stdc++.h>

#define loop(n, i) for(int i=0;i<n;i++)
#define all(v) v.begin(),v.end()
#define HERE cout << "HERE: " << __LINE__ << endl;
#define INSP(v) cout << v << " at " << __LINE__ << endl;

using namespace std;
typedef long long ll;


int dfs(int i, int count, int sum, int n, int k, int s) {
     if (count == k) {
         if (sum == s) return 1;
         else return 0;
     } else if (count > k) {
        return 0;
     } else {
         int ans = 0;
         for (int j = i+1; j <= n; j++) {
             ans += dfs(j, count+1, j+sum, n, k, s);
         }
         return ans;
     }
}

int main()
{
    int n,k,s;
    while (cin >> n >> k >> s, n) {
        cout << dfs(0,0,0,n,k,s) << endl;
    }
}

C++: #include<stdio.h>
#include<algorithm>
using namespace std;
int main(){
	int a,b,c;
	while(scanf("%d%d%d",&a,&b,&c),a){
		int ret=0;
		for(int i=0;i<(1<<a);i++){
			if(__builtin_popcount(i)!=b)continue;
			int v=0;
			for(int j=0;j<a;j++)if(i&(1<<j))v+=j+1;
			if(v==c)ret++;
		}
		printf("%d\n",ret);
	}
}

C++: #include <iostream>
#include <algorithm>
#include <vector>
#include <array>
#include <chrono>
#include <random>
#include <iterator>
#include <numeric>
#include <set>
using namespace std;
typedef long long ll;

int dp[15][200];

int main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	while(1){
		int n,k,s; cin >> n >> k >> s;
		if(n==0&&k==0&&s==0)break;
		for(int i=0;i<=k;i++){
			for(int j=0;j<=s;j++){
				dp[i][j]=0;
			}
		}
		dp[0][0]=1;
		for(int i=1;i<=n;i++){
			for(int j=s;j>=i;j--){
				for(int l=0;l<k;l++){
					dp[l+1][j]+=dp[l][j-i];
				}
			}
		}
		printf("%d\n",dp[k][s] );
	}
}

C++: #include <bits/stdc++.h>
#define rep(i,j,k) for(ll i=(ll)j;i<(ll)k;i++)
#define itrep(i,x) for(auto i=(x).begin(); i!=(x).end();i++)
#define Sort(x) sort((x).begin(),(x).end())
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define vec vector
#define INF INT_MAX
#define INFL 1e18
#define MOD 1000000007
#define pb push_back
#define MP make_pair
#define PI 3.1415926535
typedef long long int ll;
typedef std::pair<int,int> P;
int D=1;
int dx[4]={0,1,0,-1},dy[4]={-1,0,1,0};

using namespace std;

vector<int> v;
int n,k,s;
int ans=0;
void dfs(int sum, int deep, int count){
    if(count==k){
        if(sum==s)ans++;
        return;
    }
    if(deep==n)return;
    dfs(sum+v[deep],deep+1,count+1);
    dfs(sum,deep+1,count);
    return;
}

int main(){
    while(cin>>n>>k>>s && n){
        ans=0;
        v.resize(n);
        rep(i,0,n)v[i]=i+1;
        dfs(0,0,0);
        cout<<ans<<endl;
    }
    
    
    
    
    return 0;
}

C++: #define  _CRT_SECURE_NO_WARNINGS
#include "bits/stdc++.h"
#pragma comment (linker, "/STACK:526000000")

using namespace std;
typedef string::const_iterator State;
#define eps 1e-11L
#define MAX_MOD 1000000007LL
#define GYAKU 500000004LL

#define MOD 998244353LL
#define seg_size 262144*2LL
#define pb push_back
#define mp make_pair
typedef long long ll;
#define REP(a,b) for(long long (a) = 0;(a) < (b);++(a))
#define ALL(x) (x).begin(),(x).end()

unsigned long xor128() {
	static unsigned long x = 123456789, y = 362436069, z = 521288629, w = time(NULL);
	unsigned long t = (x ^ (x << 11));
	x = y; y = z; z = w;
	return (w = (w ^ (w >> 19)) ^ (t ^ (t >> 8)));
}

void init() {
	iostream::sync_with_stdio(false);
	cout << fixed << setprecision(10);
}

#define int ll
int powing(int now, int hoge) {
	int ans = 1;
	while (hoge) {
		if (hoge % 2) {
			ans *= now;
			ans %= MAX_MOD;
		}
		now *= now;
		now %= MAX_MOD;
		hoge /= 2LL;
	}
	return ans;
}

int inv(int now) {
	return powing(now, MAX_MOD - 2LL);
}

int going[1000];

vector<int> mult(vector<int> a, vector<int> b) {
	vector<int> ans;
	REP(i, 2) {
		REP(q, 2) {
			ans.push_back(0);
			REP(j, 2) {
				ans.back() += (a[i*2 + j] * b[q + 2 * j]) % MAX_MOD;
				ans.back() %= MAX_MOD;
			}
			ans.back() %= MAX_MOD;
		}
	}
	return ans;
}

int solve(int a, int b,int c) {
	vector<int> inputs;
	inputs.push_back(a);
	inputs.push_back(b);
	inputs.push_back(1);
	inputs.push_back(0);
	vector<int> gogo{ 1,0,0,1 };
	while (c) {
		if (c % 2) {
			gogo = mult(gogo, inputs);
		}
		inputs = mult(inputs, inputs);
		c /= 2;
	}
	return (gogo[0]) % MAX_MOD;
}

void solve() {
	while (true) {
		int n, k, s;
		cin >> n >> k >> s;
		if (n == 0) return;
		int dp[20][200] = {};
		dp[0][0] = 1;
		for (int i = 1; i <= n; ++i) {
			for (int q = k - 1; q >= 0; --q) {
				for (int j = 0; j <= s; ++j) {
					dp[q + 1][j + i] += dp[q][j];
				}
			}
		}
		cout << dp[k][s] << endl;
	}
}
#undef int

int main() {
	init();
	solve();
}