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

int pow(int m, int n)
{
  if (n == 1) {
    return m;
  }
  if (n == 0) {
    return 1;
  }
  if (n % 2 == 0) {
    return pow(m, n / 2) * pow(m, n / 2);
  } else {
    return m * pow(m, n - 1);
  }
}

int comb(int n, int m, int k)
{
  if (n == 1) {
    if (1 <= k && k <= m) {return 1;}  
    else {return 0;}
  }
  if (k > m * n || k < n) {return 0;}
  
  int sum = 0;
  for (int i = 1; i <= m; i++) {
    if (i >= k) {break;}
    sum += comb(n - 1, m, k - i);
  }
  return sum;
}

int main()
{
  int n, m, k;
  while (scanf("%d %d %d ", &n, &m, &k) == 3) {
    if (n == 0 && m == 0 && k == 0) {break;}
    double E = 0;
    if (n == 1) {
      if (m >= k) {
	E = (double)((m - k) * (m - k + 1) / 2 + k);
      } else {
	E = pow(m, n);
      }
    } else {
      for (int i = n; i <= n * m; i++) {
	//printf("%d %d %d = %d\n", n, m, i, comb(n, m, i));
	if (i<= k) {
	  E += (double)comb(n, m, i);
	} else {
	  E += (double)comb(n, m, i) * (i - k);
	}
      }
    }
  printf("%l.8f\n", E / pow(m, n));
  }
  return 0;
}

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

int pow(int m, int n)
{
  if (n == 1) {
    return m;
  }
  if (n == 0) {
    return 1;
  }
  if (n % 2 == 0) {
    return pow(m, n / 2) * pow(m, n / 2);
  } else {
    return m * pow(m, n - 1);
  }
}

int comb(int n, int m, int k)
{
  if (n == 1) {
    if (1 <= k && k <= m) {return 1;}  
    else {return 0;}
  }
  if (k > m * n || k < n) {return 0;}
  
  int sum = 0;
  for (int i = 1; i <= m; i++) {
    if (i >= k) {break;}
    sum += comb(n - 1, m, k - i);
  }
  return sum;
}

int main()
{
  int n, m, k;
  while (scanf("%d %d %d ", &n, &m, &k) == 3) {
    if (n == 0 && m == 0 && k == 0) {break;}
    double E = 0;
    if (n == 1) {      
      E = (m - k) * (m - k + 1) / 2 + k;
    } else {
      for (int i = n; i <= n * m; i++) {
	//printf("%d %d %d = %d\n", n, m, i, comb(n, m, i));
	if (i<= k) {
	  E += comb(n, m, i);
	} else {
	  E += comb(n, m, i) * (i - k);
	}
      }
    }
  printf("%l.9f\n", E / pow(m, n));
  }
  return 0;
}

C++: #include <iostream>
#include <cstring>
#include <string>
#include <vector>
#include <algorithm>
#include <tuple>
#include <queue>
#include <set>
#include <cstdio>
#include <climits>
#include <cmath>
#include <array>
#include <functional>
#include <sstream>
#include <list>
#include <iomanip>
#include <set>
const int MOD=1000000007;
const int INF=1000000000;
using namespace std;
typedef long long ll;
typedef vector<int> vi;
const double eps=1e-9;
const int inf=1e9;
typedef pair<int,int> P;
struct Point
{
  double x,y;
  Point(){x=0;y=0;}
  Point(double d_x,double d_y){x=d_x,y=d_y;}
  double operator*(Point obj){return obj.x*x+obj.y*y;}
  double operator%(Point obj){return obj.y*x-obj.x*y;}
  Point operator*(double b){Point tmp;tmp.x=x*b;tmp.y=y*b;return tmp;}
  Point operator/(double b){Point tmp;tmp.x=x/b;tmp.y=y/b;return tmp;}
  Point operator+(Point obj){Point tmp;tmp.x=x+obj.x;tmp.y=y+obj.y;return tmp;}
  Point operator-(){Point tmp;tmp.x=-x;tmp.y=-y;return tmp;}
  Point operator-(Point obj){Point tmp;tmp.x=x-obj.x;tmp.y=y-obj.y;return tmp;}
  Point operator-=(Point obj){x-=obj.x;y-=obj.y;return *this;}
  Point operator+=(Point obj){x+=obj.x;y+=obj.y;return *this;}
  Point operator/=(double b){x=x/b;y=y/b;return *this;}
  Point operator*=(double b){x=x*b;y=y*b;return *this;}
  double size(){return hypot(x,y);}
  Point unit(){return Point(x/size(),y/size());}
  Point normal(){return Point(y,-x);}
  double atan(){return atan2(y,x);}
};

bool operator<(Point a,Point b){return a.x!=b.x?a.x<b.x:a.y<b.y;}
bool operator>(Point a,Point b){return b<a;}
bool operator<=(Point a,Point b){return !(b<a);}
bool operator>=(Point a,Point b){return !(a<b);}
bool operator==(Point a,Point b){return (a-b).size()<eps;}
bool operator!=(Point a,Point b){return !(a==b);}

bool equal(double a,double b){return abs(a-b)<eps;}
double cross(Point a,Point b){return a%b;}
double dot(Point a,Point b){return a*b;}

int ccw(Point a,Point b,Point c)
{
  b=b-a;
  c=c-a;
  if(b%c>0) return +1;
  else if(b%c<0)return -1;
  else if(b*c<0) return +2;
  else if(b.size()<c.size()) return -2;
  else return 0;
}

int n,m,k;
vector<int> h1(15);
vector<int> h2(15);

string cmp(string a,string b)
{
  if(a.size()>b.size()) return a;
  if(b.size()>a.size()) return b;
  return max(a,b);
}

int main(int argc,char const* argv[])
{
  while(1)
    {
      cin >> n >> m >> k;
      if(!n) break;
      double dp[15][10005];
      memset(dp,0.0,sizeof(dp));
      dp[0][0]=1.0;
      for(int i=1;i<=n;i++)
	{
	  for(int j=0;j<=n*m;j++)
	    {
	      for(int k=1;k<=m;k++)
		{
		  int nxt=j+k;
		  dp[i][nxt]+=dp[i-1][j]*(double)(1.0/m+0.0);
		}
	    }
	}
      cout << fixed << setprecision(9);
      double ans=0.0;

      for(int j=1;j<=n*m;j++)
	{
	  if(j<=k)
	    {
	      dp[n][k+1]+=dp[n][j];
	    }
	  else
	    {
	      ans+=dp[n][j]*(double)(j-k);
	    }
	}
	
      cout << ans << endl;
    }
  return 0;
}

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[100000010];
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 + 100000010, 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;
	}
}