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
//------------------------------------------
#include <vector>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <stack>
#include <bitset>
#include <algorithm>
#include <functional>
#include <numeric>
#include <utility>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <cstdio>
#include <cmath>
#include <cstdlib>
#include <cctype>
#include <string>
#include <cstring>
#include <ctime>
#include <climits>
#include <queue>

using namespace std;

//typedef
//------------------------------------------
typedef vector<int> VI;
typedef vector<VI> VVI;
typedef vector<string> VS;
typedef pair<int, int> PII;
typedef long long LL;

//container util
//------------------------------------------
#define ALL(a)  (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())

//repetition
//------------------------------------------
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)

//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI  = acos(-1.0);

int hist[2][500000];

int main(){
  cin.tie(0);
  ios_base::sync_with_stdio(false);

  int N, M, K;
  while(cin>>N>>M>>K,N){
	fill((int*)hist, (int*)hist+2*500000, 0);
	int crt=0, nxt=1;
	for(int i=1;i<=M;++i)
	  hist[crt][i] = 1;

	REP(i,N-1){
	  fill(hist[nxt], hist[nxt]+500000, 0);
	  REP(j,500000){
		for(int k=1;k<=M;++k)
		  hist[nxt][j+k] += hist[crt][j];
	  }
	  swap(crt, nxt);
	}

	double ans = 0., tot = pow(M, N);
	FOR(i,N,500000){
	  if(hist[crt][i] == 0) break;
	  if(i <= K)
		ans += hist[crt][i];
	  else
		ans += hist[crt][i] * (i - K);
	}
	cout << fixed << setprecision(8) << ans / tot << endl;
  }
  
  return 0;
}

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

int n, m, k;
map<int, int> M;

void rec(int nn, int sum) {
  if(nn == n) {
    ++M[sum];
    return;
  }

  for(int i = 1; i <= m; ++i) {
    rec(nn+1, sum+i);
  }
}

double solve() {
  double ans;
  M.clear();
  rec(0, 0);
  ans = 0;
  for(int i = n; i <= n*m; ++i) {
    int a = i-k;
    if(a <= 0) a = 1;
    ans += a * M[i] / pow(double(m), double(n));
  }
  return ans;
}

main() {
  while((cin >> n >> m >> k) && (n || m || k)) {
    printf("%.8f\n", solve());
  }
}

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

using namespace std;

typedef long long ll;

#define REP(i,a,b) for(int i=a;i<(int)b;i++)
#define rep(i,n) REP(i,0,n)

ll N, M, K;

ll dfs(ll S, ll cnt) {
  
  if(cnt == N) {
    if(S-K <= 0) { return 1; }
    return S-K;
  }
  
  ll ret = 0;
  REP(i,1,M+1) {
    ret += dfs(S+i, cnt+1);
  }
  return ret;
}

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

C++: #include<algorithm>
#include<iostream>
#include<string>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
using namespace std;
int n,m,k;
int fn(int p,int q){
  int i;
  int sm=0;
  if(p==n){
    sm=max(q-k,1);
  }else{
    for(i=1;i<m+1;i++)
      sm+=fn(p+1,q+i);
  }
  return sm;
}
int main(){
  while(cin>>n>>m>>k&&n+m+k)
    printf("%.8lf\n",fn(0,0)/pow(m,n));
  return 0;
}

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 <bits/stdc++.h>

using namespace std;

int N,M,K;
map<int,int> mp;

void make(int n,int sum){
  if(N == n){
    if(sum-K <= 0){
      mp[1]++;
    }else{
      mp[sum-K]++;
    }
    return;
  }
  for(int i = 0 ; i < M ; i++){
    make(n+1,sum+i+1);
  }
}

int main(){
  while(cin >> N >> M >> K, N){
    mp.clear();
    make(0,0);
    double ans = 0;
    map<int,int>::iterator it;
    for(it = mp.begin() ; it != mp.end() ; ++it){
      ans += ((double)it->second/pow((double)M,N))*it->first;
    }
    printf("%.8f\n",ans);
  }
  return 0;
}

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

int main(int argc, char *argv[]){
  int n, m, k;
  while(cin >> n >> m >> k, n){
    double ans = 0;
    long long int dp[n + 1][n*m + 1];//num of dice, sum of the spot
    int w = n*m;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= w; j++) {
        dp[i][j] = 0;
      }
    }
    for (int i = 1; i <= w; i++) {
      if(i <= m)
        dp[1][i] = 1;
      else
        dp[1][i] = 0;
    }
    for (int i = 2; i <= n; i++) {
      for (int j = 1; j <= w; j++) {
        for (int k = 1; k <= m; k++) {
          if(k < j)
            dp[i][j] += dp[i - 1][j - k];
        }
      }
    }

    // for (int i = 1; i <= n; i++) {
    //   for (int j = 1; j <= w; j++) {
    //     std::cout << dp[i][j] << " ";
    //   }
    //   std::cout << std::endl;
    // }

    int deno = 1; 
    for (int i = 0; i < n; i++) {
      deno *= m;
    }
    for (int i = n; i <= w; i++) {
      if(i <= k){
        ans += dp[n][i];
      }else{
        ans += dp[n][i] * (i - k);
      }
    }
    printf("%.8lf\n", ans / deno);
  }
  return 0;
}

C++: #include <iostream>
#include <cmath>

#define N 100000

using namespace std;

main(){
  int n, m, k;
  while(1){
    cin >> n >> m >> k;
    if(n==0 && m==0 && k==0) break;

    int data[N];
    for(int i=0;i<=n*m;i++) data[i]=0;
    int num[15];
    for(int i=1;i<=n;i++) num[i]=1;
    bool end=false;
    for(;;){
      int sum=0;
      for(int i=1;i<=n;i++){
	//printf(" %d", num[i]);
	sum+=num[i];
      }
      //cout << endl;
      data[sum]++;
      if(num[n]==m){
	num[n]=0;
	for(int t=n-1;;){
	  if(t<=0){
	    end=true;
	    break;
	  }
	  if(num[t]<m){
	    num[t]++;
	    break;
	  }else{
	    num[t]=1;
	    t--;
	  }
	}
	if(end) break;
      }
      num[n]++;
    }
    double ans=0;
    for(int i=1;i<=k;i++){
      ans+=(double)data[i]/pow((double)m, (double)n);
    }
    for(int i=k+1, j=1;i<=n*m;i++, j++){
      ans+=(double)data[i]*j/pow((double)m, (double)n);
    }
    printf("%.10f\n", ans);
  }
  return 0;
}