P27423 [AtCoder] Ordinary Beauty
普及+
题目描述

Problem Description

The beauty of a sequence $ (a_1, ..., a_n) $ is defined as the number of pairs of adjacent terms whose absolute difference is $ d $. For example, when $ d = 1 $, the beauty of the sequence $ (3, 2, 3, 10, 9) $ is $ 3 $.

There are a total of $ n^m $ sequences of length $ m $ where each element is an integer between $ 1 $ and $ n $. Calculate the beauty for all these $ n^m $ sequences and output their average.

Input Format

The input is given from the standard input in the following format:

$ n $ $ m $ $ d $

Output Format

Output the average beauty of sequences of length $ m $ where each element is an integer between $ 1 $ and $ n $. The answer will be considered correct if the absolute or relative error is at most $ 10^{-6} $.

Sample Input and Output

Sample Input #1

2 3 1

Sample Output #1

1.0000000000

Sample Input #2

1000000000 180707 0

Sample Output #2

0.0001807060

Notes/Hints

Constraints

  • $0 \leq d < n \leq 10^9$
  • $2 \leq m \leq 10^9$
  • All inputs are integers

Sample Explanation 1

The beauty of $ (1,1,1) $ is $ 0 $. The beauty of $ (1,1,2) $ is $ 1 $. The beauty of $ (1,2,1) $ is $ 2 $. The beauty of $ (1,2,2) $ is $ 1 $. The beauty of $ (2,1,1) $ is $ 1 $. The beauty of $ (2,1,2) $ is $ 2 $. The beauty of $ (2,2,1) $ is $ 1 $. The beauty of $ (2,2,2) $ is $ 0 $. The average of these, $ (0+1+2+1+1+2+1+0)/8=1 $, is the answer.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
2 3 1
样例输出
1.0000000000