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 <iomanip>
#include <string>
#include <sstream>
#include <algorithm>
#include <vector>
#include <utility>
#include <stack>
#include <queue>
#include <map>
#include <set>
#include <functional>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <cmath>
#include <cassert>
 
using namespace std;
 
#define REP(i,s,e) for(int i=(s); i<(int)(e); i++)
#define rep(i,n) REP(i, 0, n)
#define pb push_back
#define mp make_pair
#define all(r) (r).begin(),(r).end()
#define rall(r) (r).rbegin(),(r).rend()
#define fi first
#define se second
#define DBG(X) cout<<" "<<#X<<" : "<<X<<endl
 
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int, int> pii;

const int INF = 1e9;
const double EPS = 1e-8;
const int mod = 1e9 + 7;
const ll LINF = 1e18;

struct Input
{
	int n;char c;char str[10010];string s;ll l;double d;
	int nextInt(){scanf("%d", &n);return n;}
	ll nextLong(){scanf("%lld", &l);return l;}
	double nextDouble(){scanf("%lf", &d);return d;}
	char nextChar(){scanf("%c", &c);return c;}
	string next(){scanf("%s", str);return string(str);}
	string nextLine(){getline(cin, s);return s;}
};
Input in;


int dp[30][1000010];

ll mod_pow(ll x, int n, int mod){
	if(n == 0) return 1LL;
	int ret = mod_pow(x*x % mod, n / 2, mod);
	if(n & 1) ret *= x;
	return ret % mod;
}

int main(){
	while(1){
		int n = in.nextInt(), m = in.nextInt(), K = in.nextInt();
		if(n == 0 && m == 0 && K == 0) break;
		for(int i = 0; i < 1e6 + 10; i++) for(int j = 0; j < 30; j++) dp[j][i] = 0;
		dp[0][0] = 1;
		for(int i = 1; i <= n; i++){
			for(int j = 0; j <= m*n; j++){
				for(int k = 1; k<= m; k++){
					dp[i][j+k] += dp[i-1][j];
				}
			}
		}
		double d = mod_pow(m, n, mod);
		//cout<<" "<<d<<endl;
		double ans = 0.0;
		for(int i = 0; i <= 1e6; i++) ans += max(1.0, (double)i-K) * dp[n][i] / d;
		
		printf("%.15lf\n", ans);
	}
}

C++: #include <cstdio>
#include <iostream>
#include <string>
#include <sstream>
#include <stack>
#include <algorithm>
#include <cmath>
#include <queue>
#include <map>
#include <set>
#include <cstdlib>
#include <bitset>
#include <tuple>
#include <assert.h>
#include <deque>
#include <bitset>
#include <iomanip>
#include <limits>
#include <chrono>
#include <random>
#include <array>
#include <unordered_map>
#include <functional>
#include <complex>
#include <numeric>
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }

constexpr long long MAX = 5100000;
constexpr long long INF = 1LL << 60;
constexpr int inf = 1 << 28;
constexpr long long mod = 1000000007LL;
//constexpr long long mod = 998244353LL;

using namespace std;
typedef unsigned long long ull;
typedef long long ll;


void solve() {
	ll n, m, k; scanf("%lld %lld %lld", &n, &m, &k); if (n == 0 and m == 0 and k == 0) exit(0);
	vector<vector<double>> dp(n + 1, vector<double>(n * m + 1));
	dp[0][0] = 1;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j <= n * m; j++) {
			if (dp[i][j] < 1e-14) continue;
			for (int k = 1; k <= m; k++) {
				if (j + k <= n * m) {
					dp[i + 1][j + k] += dp[i][j] / (double)m;
				}
			}
		}
	}
	double res = 0;
	for (int i = 1; i <= n * m; i++) {
		res += dp[n][i] * max(1LL, i - k);
	}
	printf("%.12f\n", res);
}

int main()
{
	/*
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	*/
	int kkt = 89;
	while (kkt) {
		solve();
	}
	return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

int main(){
	ios_base::sync_with_stdio(false);
	cout << setiosflags(ios::fixed) << setprecision(10);
	while(true){
		int n, m, k;
		cin >> n >> m >> k;
		if(n == 0 && m == 0 && k == 0){ break; }
		double answer = 0;
		if(n == 1){
			if(k == 0){
				const double t = static_cast<double>(m);
				answer = t * (t - 1) * 0.5 / t;
			}else{
				const double t = static_cast<double>(m - k + 1);
				const double r = t / m;
				answer += (t * (t - 1) * 0.5 / t) * r;
				answer += 1.0 - r;
			}
		}else{
			const double r = 1.0 / m;
			const int len = n * m + 1;
			vector<double> dp(len);
			dp[0] = 1.0;
			for(int i = 0; i < n; ++i){
				vector<double> next(len + 1);
				for(int j = 0; j + m < len; ++j){
					next[j + 1] += r * dp[j];
					next[j + m + 1] -= r * dp[j];
				}
				double sum = 0.0;
				for(int j = 0; j <= len; ++j){
					sum += next[j];
					next[j] = sum;
				}
				dp.swap(next);
			}
			for(int i = n; i < len; ++i){
				answer += dp[i] * max(1, i - k); 
			}
		}
		cout << answer << endl;
	}
	return 0;
}

C++: #include <algorithm>
#include <cstdio>
#include <iostream>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <string>
#include <vector>
#include <stdlib.h>
#include <stdio.h>
#include <bitset>
#include <cstring>
#include <deque>
using namespace std;
#define FOR(I,A,B) for(int I = (A); I < (B); ++I)
#define CLR(mat) memset(mat, 0, sizeof(mat))
typedef long long ll;
int main()
{
  ll n,m,k;
  while(cin>>n>>m>>k,n||m||k) {
    ll dp[n+1][n*m+1]; CLR(dp);
    dp[0][0] = 1;
    FOR(i,0,n) {
      FOR(j,0,m*i+1) {
        FOR(t,1,m+1) {
          dp[i+1][j+t] += dp[i][j];
        }
      }
    }
    double ans = 0;
    ll waru = pow(m, n);
    FOR(i,0,n*m+1) {
      ans += (double)dp[n][i] * max(1LL, i-k) / waru;
    }
    printf("%.10lf\n", ans);
  }
}

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

int N, M, K;
map< pair< int, int >, long long > dp;
long long rec(int idx, int sum)
{
  if(idx == N) return(max(1, sum - K));
  if(dp.find({idx, sum}) != dp.end()) return(dp[{idx, sum}]);
  long long ret = 0;
  for(int i = 1; i <= M; i++) ret += rec(idx + 1, sum + i);
  return(dp[{idx, sum}] = ret);
}

int main()
{
  while(cin >> N >> M >> K, N) {
    dp.clear();
    long long ret = 0, power = 1;
    for(int i = 0; i < N; i++) power *= M;
    cout << fixed << 1.0 * rec(0, 0) / power << endl;
  }
}

C++: #define _CRT_SECURE_NO_WARNINGS
#define _USE_MATH_DEFINES

#include "bits/stdc++.h"
#define REP(i,a,b) for(int 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 ALL(a) begin(a),end(a)
#define ifnot(a) if(not a)
#define dump(x)  cerr << #x << " = " << (x) << endl
using namespace std;

// #define int ll
#ifdef _MSC_VER
const bool test = true;
#else 
const bool test = false;
#endif

int dx[] = { 0,1,0,-1 };
int dy[] = { 1,0,-1,0 };
#define INF (1 << 28)
ull mod = (int)1e9 + 7;
//.....................
#define MAX (int)1e6 + 5

int n, m, k;

template<class T>
T pow(T x, T n) {
	T res = 1;
	while (n > 0) {
		if (n & 1) res = res * x;
		x = x * x;
		n >>= 1;
	}
	return res;
}

ll dfs(int now_v,int cnt) {
	if (cnt == n) return max(now_v - k, 1);
	ll res = 0;
	REP(i, 1, m + 1) res += dfs(now_v + i, cnt + 1);
	return res;
}

signed main() {
	cout << setprecision(20) << fixed;
	while (cin >> n >> m >> k) {
		if (n == 0) break;
		cout << (double)dfs(0, 0) / pow(m, n) << endl;
	}
	return 0;
}