Go: package main

import (
	"fmt"
	"math"
)

func main(){
	var n, m, k int
	for {
		fmt.Scan(&n, &m, &k)
		if n == 0 && m == 0 && k == 0{
			break
		}

		dp := make([][]int, n+1)
		for i:= 0; i < n+1; i++{
			dp[i] = make([]int, m*n + 1)
		}

		for i := 1; i <=m ; i++{
			dp[1][i] = 1
		}

		for i:= 1; i < n; i++{
			for j := 0; j <= i * m; j++{
				for k := 1; k <= m; k++{
					dp[i+1][j+k] += dp[i][j]
				}
			}
		}

		count := 0.0
		div := math.Pow(float64(m), float64(n))
		for i := 0; i <= n * m; i++{
			bill := 0.0
			if i <= k{
				bill = 1.0
			} else {
				bill = float64(i - k)
			}
			count += bill * float64(dp[n][i]) / div
		}
		fmt.Printf("%.010f\n", count)
	}
}

C++: #include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cmath>
#include <cstdio>
#include <functional>
#include <numeric>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <utility>
#include <sstream>
#include <complex>
#include <fstream>
#include <bitset>
#include <time.h>

using namespace std;

typedef long long ll;
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef complex<double> Point;

#define PI acos(-1.0)
#define EPS 1e-10
const ll INF = (1LL << 31) - 1;
const ll MOD = 1e9 + 7;

#define FOR(i,a,b) for(int i=(a);i<(b);i++)
#define REP(i,N) for(int i=0;i<(N);i++)
#define ALL(s) (s).begin(),(s).end()
#define EQ(a,b) (abs((a)-(b))<EPS)
#define EQV(a,b) ( EQ((a).real(), (b).real()) && EQ((a).imag(), (b).imag()) )
#define fi first
#define se second
#define N_SIZE (1LL << 20)
#define NIL -1
#define MAX_N 100100 * 3

int n, m, k;
double sum[100100];
double cntd[100100];

void solve(int num, int cnt) {
	if (cnt == n) {
		cntd[num]++;
		return;
	}
	FOR(i, 1, m + 1)solve(num + i, cnt + 1);
}

int main() {
	while (cin >> n >> m >> k&&n + m + k) {
		fill(sum, sum + 100100, 0);
		fill(cntd, cntd + 100100, 0);
		double t = pow(m, n);
		ll lb = n, ub = n*m;
		double num = 1;
		solve(0, 0);
		while (1) {
			//cout << lb << " " << ub << " ";
			//cout << num << endl;
			if (lb == ub) {
				if (lb > k)sum[lb] += cntd[lb];
				else sum[k + 1] += cntd[lb];
				break;
			}
			else {
				if (lb > ub)break;
				if (lb > k)sum[lb] += cntd[lb];
				else sum[k + 1] += cntd[lb];
				if (ub > k)sum[ub] += cntd[lb];
				else sum[k + 1] += cntd[lb];
			}
			lb++;
			ub--;
		}
		double ans = 0;
		REP(i, n*m + 1) {
			double num = i;
			//cout << i << " " << sum[i] << " " << sum[i] / t << endl;
			ans += (sum[i] / t)*(num - k);
		}
		cout << ans << endl;
	}
}

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

typedef long long ll;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define each(itr,c) for(__typeof(c.begin()) itr=c.begin(); itr!=c.end(); ++itr)
#define all(x) (x).begin(),(x).end()
#define mp make_pair
#define pb push_back
#define fi first
#define se second

const int N=1000000;
double dp[N],dp2[N];

int main()
{
    int n,m,k;
    while(cin >>n >>m >>k,n|m|k)
    {
        memset(dp,0,sizeof(dp));
        dp[0]=1;

        rep(i,n)
        {
            memset(dp2,0,sizeof(dp2));

            for(int j=i; j<=m*i; ++j)
            {
                for(int k=1; k<=m; ++k)
                {
                    if(j+k>=N) break;
                    dp2[j+k]+=dp[j]/m;
                }
            }

            rep(j,N) dp[j]=dp2[j];
        }

        double ans=0;
        rep(i,N) ans+=max(1,i-k)*dp[i];

        printf("%.10lf\n",ans);
    }
    return 0;
}

C++: #include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<cmath>
#include<algorithm>
#include<functional>
#include<iomanip>
#include<queue>
#include<ciso646>
#include<random>
#include<map>
#include<set>
using namespace std;
typedef long long ll;
const ll MOD = 1000000007;
const ll INF = (ll)1000000007 * 1000000007;
const double EPS = 1e-9;
typedef pair<int, int> P;
typedef unsigned int ui;
#define stop char nyaa;cin>>nyaa;
#define rep(i,n) for(int i=0;i<n;i++)
#define Rep(i,sta,n) for(int i=sta;i<n;i++)
#define rep1(i,n) for(int i=1;i<=n;i++)
#define per1(i,n) for(int i=n;i>=1;i--)
int main() {
	int n, m, k;
	while (cin >> n >> m >> k, n) {
		if (n > 1) {
			ll cnt = 0; int dp[200] = {};
			dp[0] = 1;
			rep(i, n) {
				for (int j = 199; j >= 0; j--) {
					rep1(k, m) {
						if (j + k < 200) {
							dp[j + k] += dp[j];
						}
					}
					dp[j] = 0;
				}
			}
			rep(i, 200) {
				int x = i - k;
				if (x <= 0)x = 1;
				cnt += (ll)dp[i] * x;
			}
			int r = 1;
			rep(i, n) {
				r *= m;
			}
			cout << fixed << setprecision(8) << cnt / (double)r << endl;
		}
		else {
			ll sum = 0;
			rep1(i, m) {
				int x = i - k;
				if (x <= 0)x = 1;
				sum += (ll)x;
			}
			cout << fixed << setprecision(8) << sum / (double)m << endl;
		}
	}
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <sstream>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <climits>
#include <cfloat>
#include <vector>
#include <string>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <algorithm>
#include <functional>
#include <utility>
#include <numeric>
#include <iterator>

using namespace std;

typedef long long LL;
typedef unsigned long long ULL;
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int,int> PII;
typedef vector<PII> VPII;
typedef istringstream ISS;
typedef ostringstream OSS;

#define REP( i, m, n ) for ( int i = (int)( m ); i < (int)( n ); ++i )
#define FOR( v, c ) for ( auto &v : c )
#define EACH( it, c ) for ( auto it = c.begin(); it != c.end(); ++it )
#define ALL( c ) (c).begin(), (c).end()
#define DRANGE( c, p ) (c).begin(), (c).begin() + p, (c).end()

#define PB( n ) push_back( n )
#define MP( a, b ) make_pair( ( a ), ( b ) )
#define EXIST( c, e ) ( (c).find( e ) != (c).end() )

#define fst first
#define snd second

#define DUMP( x ) cerr << #x << " = " << ( x ) << endl
#define DEBUG( x ) cerr << __FILE__ << ":" << __LINE__ << ": " << #x << " = " << ( x ) << endl

struct Solver
{
	const int N, M, K;
	double res;

	Solver( int n, int m, int k ) :
		N( n ), M( m ), K( k ), res( 0. )
	{
		return;
	}

	operator double()
	{
		dfs( 0, 0 );
		return res;
	}

	void dfs( int depth, int sum )
	{
		if ( depth == N )
		{
			res += 1. * max( 1, sum - K ) / pow( M, N );
			return;
		}

		REP( i, 0, M )
		{
			dfs( depth + 1, sum + i + 1 );
		}
		return;
	}
};

int main()
{
	cin.tie( 0 );
	ios::sync_with_stdio( false );
	cout << setprecision( 9 ) << fixed;

	for ( int n, m, k; cin >> n >> m >> k, n | m | k; )
	{
		cout << Solver( n, m, k ) << endl;
	}

	return 0;
}