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 <cstring>
#include <stack>
#include <set>
#include <stdio.h>
#include <string>
#include <vector>
#include <algorithm>
#include <limits.h>
using namespace std;
typedef vector<int> vi;
typedef vector<pair<int,int> > vp;
vector<pair<double,int> > member;
const double eps=1e-9;
typedef pair<int,int> p;
double dp[3000][3000];
int main()
{
  int n,m,k;
  while(cin >> n >> m >> k && n)
    {
      double ans=0.0;
      double tmp=1.0/double(m+0.0);
      memset(dp,0,sizeof(dp));
      dp[0][0]=1.0;
      if(n==1)
	{
	  for(int i=1;i<=m;i++)
	    {
	      if(i-k<=0)
		{
		  ans+=tmp;
		}
	      else
		{
		  ans+=tmp*(i-k);
		}
	    }
	  cout << fixed << setprecision(12) << ans << endl;
	}
      else
	{
	  for(int i=1;i<=n;i++)
	    {
	      for(int j=1;j<=m;j++)
		{
		  for(int k=0;k<=i*m;k++)
		    {
		      dp[i][k+j]+=dp[i-1][k]*tmp;
		    }
		}
	    }
	  for(int i=n;i<=m*n;i++)
	    {
	      if(i-k<=0)
		{
		  ans+=dp[n][i];
		}
	      else
		{
		  ans+=dp[n][i]*(i-k);
		}
	    }
	  cout << fixed << setprecision(12) << ans << endl;
	}
    }
  return 0;
}

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

int solve_testcase() {
  int N, M, K; cin >> N >> M >> K;
  if(N == 0 and M == 0 and K == 0) return 1;

  vector< vector<double> > dp(N+1, vector<double>(N*M + 1));
  dp[0][0] = 1.0;
  for(int i=0; i<N; i++) {
    for(int j=0; j<=i*M; j++) {
      for(int k=1; k<=M; k++) {
        dp[i+1][j+k] += dp[i][j] / M;
      }
    }
  }

  double ans = 0.0;
  for(int i=0; i<=N*M; i++) {
    int val = max(1, i - K);
    ans += val * dp[N][i];
  }
  printf("%.12f\n", ans);
  return 0;
}

int main() {
  while(!solve_testcase());
  return 0;
}

C++: #include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <cstring>
#include <queue>
#include <cmath>

#define rep(i,n) for(int i = 0; i < (n); i++)
#define all(v) (v).begin(), (v).end()
#define rev(v) (v).rbegin(), (v).rend()
#define MP make_pair
using namespace std;

typedef vector<int> vi;
typedef pair<int, int> P;
typedef long long ll;

int main(){
	//freopen("test.txt", "r", stdin);

	cout.setf(ios::fixed);
	cout.precision(8);

	int n, m, k;
	while(cin >> n >> m >> k, n|m|k){
		int size = n*m+1;
		vector<vi> v(2, vi(size, 0));
		v[0][0] = 1;
		int next = 1;
		rep(j, n){
			v[next] = vi(size, 0);
			for(int k = j; k <= j*m; k++){
				if(v[!next][k] == 0)continue;
				for(int i = 1; i <= m; i++){
					v[next][k+i] += v[!next][k];
				}
			}
			next = !next;
		}

		double ans = 0;
		double d = pow((double)m, n);

		for(int i = n; i < size; i++){
//			printf("%d/%d*%d+", v[!next][i], (int)d, max(i-k, 1));
			ans += v[!next][i]*(max(i-k, 1))/d;
		}

		cout << ans << endl;

	}

	return 0;
}

C++: #include <iostream>
#include <cstdio>
using namespace std;
void func(int,int);
int n,m,k,d[10000],ans,t;

int main(){
  while(1){
    cin>>n>>m>>k;
    if(!n&&!m&&!k) break;
    for(int i=0;i<10000;i++) d[i]=0;
    func(0,0);
    t=1;
    for(int i=0;i<n;i++) t*=m;
    ans=0;
    for(int i=0;i<10000;i++) ans+=i*d[i];
    printf("%.8f\n",1.0*ans/t);
  }
}

void func(int x,int r){
  if(x==n){
    if(r-k<=0) d[1]++;
    else d[r-k]++;
  }else
    for(int i=1;i<=m;i++) func(x+1,i+r);
}

C++: #include <iostream>
#include <stdio.h>
#include <algorithm>
#include <vector>
#include <queue>
#include <numeric>
#include <string>
#include <string.h>
#include <map>
#include <set>
#include <functional>
#include <complex>
#include <stack>
#include <tuple>
#include <array>
using namespace std;
#define rep(i,n) for (int i=0; i < (n); i++)


typedef long long int ll;
typedef double D;      // ??§?¨?????????????double???long double?????????
typedef complex<D> P;  // Point
typedef pair<P, P> L;  // Line
typedef vector<P> VP;


const int INF = (1<<30) - 1;
const D EPS = 1e-9;

#define X real()
#define Y imag()
#define LE(n,m) ((n) < (m) + EPS)
#define GE(n,m) ((n) + EPS > (m))
#define EQ(n,m) (abs((n)-(m)) < EPS)

int N, M, K;

int dfs(int cur, int s){
    if(cur == 0){
        return s-K > 0 ? s-K: 1;
    }
    
    int ans = 0;
    for(int i=1; i<=M; i++){
        ans += dfs(cur-1, s+i);
    }
    return ans;
}

void solve(){
    double d = dfs(N, 0);
    for(int i=0; i<N; i++)
        d /= M;
    cout << d << endl;
}

//g++ -std=c++0x -msse4.2 -O3
//#include <bits/stdc++.h>
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.precision(16);
    cout.setf(ios::fixed);
    
    
    while(cin>>N>>M>>K, N|M|K)
        solve();
    
    return 0;
}

C++: #include <iostream>
#include <iomanip>
#include <cstdio>
#include <string>
#include <cstring>
#include <deque>
#include <list>
#include <queue>
#include <stack>
#include <vector>
#include <utility>
#include <algorithm>
#include <map>
#include <set>
#include <complex>
#include <cmath>
#include <limits>
#include <cfloat>
#include <climits>
#include <ctime>
#include <cassert>
#include <numeric>
using namespace std;

#define rep(i,a,n) for(int (i)=(a); (i)<(n); (i)++)
#define repq(i,a,n) for(int (i)=(a); (i)<=(n); (i)++)
#define repr(i,a,n) for(int (i)=(a); (i)>=(n); (i)--)
#define all(v) begin(v), end(v)
#define pb(a) push_back(a)
#define fr first
#define sc second
#define INF 2000000000
#define int long long int

#define X real()
#define Y imag()
#define EPS (1e-10)
#define EQ(a,b) (abs((a) - (b)) < EPS)
#define EQV(a,b) ( EQ((a).X, (b).X) && EQ((a).Y, (b).Y) )
#define LE(n, m) ((n) < (m) + EPS)
#define LEQ(n, m) ((n) <= (m) + EPS)
#define GE(n, m) ((n) + EPS > (m))
#define GEQ(n, m) ((n) + EPS >= (m))

typedef vector<int> VI;
typedef vector<VI> MAT;
typedef pair<int, int> pii;
typedef long long ll;

typedef complex<double> P;
typedef pair<P, P> L;
typedef pair<P, double> C;

int dx[]={1, -1, 0, 0};
int dy[]={0, 0, 1, -1};
int const MOD = 1000000007;
ll mod_pow(ll x, ll n) {return (!n)?1:(mod_pow((x*x)%MOD,n/2)*((n&1)?x:1))%MOD;}
int madd(int a, int b) {return (a + b) % MOD;}
int msub(int a, int b) {return (a - b + MOD) % MOD;}
int mmul(int a, int b) {return (a * b) % MOD;}
int minv(int a) {return mod_pow(a, MOD-2);}
int mdiv(int a, int b) {return mmul(a, minv(b));}

namespace std {
    bool operator<(const P& a, const P& b) {
        return a.X != b.X ? a.X < b.X : a.Y < b.Y;
    }
}

int n, m, k;
double ans;

void dfs(int sum, double p, int cnt) {
    if(cnt == n) {
        ans += p * max((ll)1, sum-k);
    }
    else {
        repq(i,1,m) {
            dfs(sum+i, p * 1.0/m, cnt+1);
        }
    }
}

signed main() {
    while(cin >> n >> m >> k, n || m || k) {
        ans = 0.0;
        dfs(0, 1.0, 0);
        printf("%.12f\n", ans);
    }
    return 0;
}

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

int N, M, K;

double rec(int k, double sum) {
  if(k == N) {
    return max(1.0, sum-K);
  }
  double res = 0;
  for(int i = 1; i <= M; ++i) {
    res += rec(k+1, sum+i);
  }
  return res;
}

int main() {
  while(cin >> N >> M >> K && (N|M|K)) {
    printf("%.10f\n", rec(0, 0.0)/pow((double)M, (double)N));
  }
  return 0;
}