#if __INCLUDE_LEVEL__ == 0 #include __BASE_FILE__ void Solve() { int64_t n, m, k; IN(n, m, k); double ans = 0.0; /* for (int64_t x = 1; x <= n; ++x) { if (k <= (x - 1) * m) { ans += 1.0; } else if (k <= (n - 1) * m + 1) { ans += double(m - 1) / double(m); } else { ans += double(m - 1) / double(m) * (1.0 - double(k - (n - 1) * m - 1) / (double(m - 1))); } } */ int64_t X = DivCeil(k, m); ans += double(n - X); if (k <= (n - 1) * m + 1) { ans += double(m - 1) / double(m) * X; } else { ans += double(m - 1) / double(m) * (1.0 - double(k - (n - 1) * m - 1) / (double(m - 1))) * X; } ans /= double(n); OUT(ans); } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout << setprecision(DBL_DECIMAL_DIG); int t; IN(t); while (t--) { Solve(); } } #elif __INCLUDE_LEVEL__ == 1 #include template concept MyRange = std::ranges::range && !std::convertible_to && !std::convertible_to; template concept MyTuple = std::__is_tuple_like::value && !MyRange; namespace std { istream& operator>>(istream& is, MyRange auto&& r) { for (auto&& e : r) { is >> e; } return is; } istream& operator>>(istream& is, MyTuple auto&& t) { apply([&](auto&... xs) { (is >> ... >> xs); }, t); return is; } ostream& operator<<(ostream& os, MyRange auto&& r) { auto sep = ""; for (auto&& e : r) { os << exchange(sep, " ") << forward(e); } return os; } ostream& operator<<(ostream& os, MyTuple auto&& t) { auto sep = ""; apply([&](auto&... xs) { ((os << exchange(sep, " ") << xs), ...); }, t); return os; } } // namespace std template class OneBased { public: explicit OneBased(T&& x) : ref_(std::forward(x)) {} template requires(sizeof...(Ts) > 1) OneBased(Ts&&... xs) : ref_(std::forward_as_tuple(std::forward(xs)...)) {} friend std::istream& operator>>(std::istream& is, OneBased x) { if constexpr (MyRange) { for (auto&& e : x.ref_) { is >> ::OneBased(e); } } else if constexpr (MyTuple) { std::apply([&](auto&... xs) { (is >> ... >> ::OneBased(xs)); }, x.ref_); } else { is >> x.ref_; --x.ref_; } return is; } friend std::ostream& operator<<(std::ostream& os, OneBased x) { if constexpr (MyRange) { auto f = [](auto&& e) { return ::OneBased(std::forward(e)); }; os << (x.ref_ | std::views::transform(f)); } else if constexpr (MyTuple) { std::apply([&](auto&... xs) { os << std::tuple(::OneBased(xs)...); }, x.ref_); } else { os << ++x.ref_; --x.ref_; } return os; } private: T ref_; }; template OneBased(T&&) -> OneBased; template OneBased(Ts&&...) -> OneBased>; using namespace std; #define LAMBDA2(x, y, ...) ([&](auto&& x, auto&& y) -> decltype(auto) { return __VA_ARGS__; }) #define DivCeil(...) LAMBDA2(x, y, x / y + ((x ^ y) >= 0 && x % y))(__VA_ARGS__) #define IN(...) (cin >> forward_as_tuple(__VA_ARGS__)) #define OUT(...) (cout << forward_as_tuple(__VA_ARGS__) << '\n') #endif // __INCLUDE_LEVEL__ == 1