#include #include #include using namespace std; using namespace atcoder; //loop #define REP(i, n) for (ll i = 0; i < (ll)(n); i++) //vector #define ALL(A) A.begin(), A.end() #define RV(A) reverse(ALL(A)) #define RALL(A) A.rbegin(), A.rend() #define SORT(A) sort(ALL(A)) #define RSORT(A) sort(RALL(A)) //input template inline void input(T& a) { cin >> a; } template inline void input_li(T& a) {for(auto &ob:a) cin >> ob;} template inline void input(T&... a) { ((cin >> a), ...); } //output #define Yes(bo) cout << ((bo) ? "Yes":"No") << endl #define YES(bo) cout << ((bo) ? "YES":"NO") << endl #define yes(bo) cout << ((bo) ? "yes":"no") << endl #define Taka(bo) cout << ((bo) ? "Takahashi":"Aoki") << endl //other #define pb push_back #define pf push_front #define ppb pop_back #define ppf pop_front #define sz size #define is insert #define ps push #define tp top #define ft front #define pp pop template inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0;} template inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0;} //const #define I_MAX 2147483647 #define I_MIN -2147483647 #define UI_MAX 4294967295 #define LL_MAX 9223372036854775807 #define LL_MIN -9223372036854775808 #define ULL_MAX 18446744073709551615 //type using ll = long long; using ull = unsigned long long; using ld = long double; using Pair = pair; using vll = vector; using mint = modint998244353; using mint1 = modint1000000007; const ll Inf = 1LL << 60; //debug #ifdef _DEBUG #define debug(x) cerr << "dbg_var : " << #x << ": " << x << endl #define debug2(x,y) cerr << "dbg_var : " << #x << ": " << x << " "<< #y << ": " << y << endl #define debug3(x,y,z) cerr << "dbg_var : " << #x << ": " << x << " "<< #y << ": " << y << " " << #z << ": " << z < b) {ll res=0;for(auto v:b){res+=v;}return res;} ll GCD(ll a, ll b) {if (b == 0) return a;else return GCD(b, a % b);} ll LCM(ll a, ll b) {ll d=GCD(a,b);return (a/d)*(b/d)*d;} /*zahyou to ka*/ bool poich(ll P,ll Q){return(0<=P&&P dxy{{1,0},{-1,0},{0,1},{0,-1}}; //https://algo-logic.info/calc-pow/ ll dpow(ll x, ll n,ll mod) { ll ret = 1; while (n > 0) { if (n & 1) ret = ret * x % mod; x = x * x % mod; n >>= 1; } return ret; } ll chd21(ll N,ll i,ll j){ return N*i+j; } Pair chd12(ll N,ll X){ return {X/N,X%N}; } //input template void input_v(vector &vec){ for(auto &v:vec)cin >> v; } vector MakePrime(long long MAX_N){ vector Isprime,Prime; Isprime.resize(MAX_N+2,true); Isprime[0]=false; Isprime[1]=false; for(long long i=2;i*i<=MAX_N;i++){ if(Isprime[i]){ for(long long j=i*i;j<=MAX_N;j+=i)Isprime[j]=false; } } for(long long i=0;i struct comb{ public: comb():comb(10000000){} comb(ll N):A(N,1),B(N,1){ for(ll i=0;i A; vector B; }; vector> totu_cover(vector> points){ vector> p=points; sort(p.begin(),p.end()); ll N=p.size(); auto func=[&](bool bo){ stack> st; queue> que; ll k=2*bo-1; for(ll i=N-1;i>=0;i--){ que.push(p[i]); } while(!que.empty()){ auto v=que.front(); if(st.size()<2){ st.push(v); que.pop(); }else{ auto o=st.top();st.pop(); auto t=st.top(); auto[a,b]=t; auto[c,d]=o; auto[e,f]=v; if((f-b)*(a-c)*k>(d-b)*(a-e)*k){ continue; }else{ st.push(o); st.push(v); que.pop(); } } } vector> res; while(!st.empty()){ res.push_back(st.top()); st.pop(); } return res; }; auto v=func(1); auto u=func(0); ll vn=v.size(),un=u.size(); vector> ans; set> cot; for(ll i=vn-1;i>=0;i--){ ans.push_back(v[i]); cot.insert(v[i]); } for(ll i=0;i>; /* LCA(G, root): 木 G に対する根を root として Lowest Common Ancestor を求める構造体 query(u,v): u と v の LCA を求める。計算量 O(logn) 前処理: O(nlogn)時間, O(nlogn)空間 */ struct LCA { vector> parent; // parent[k][u]:= u の 2^k 先の親 vector dist; // root からの距離 LCA(const Graph &G, int root = 0) { init(G, root); } // 初期化 void init(const Graph &G, int root = 0) { int V = G.size(); int K = 1; while ((1 << K) < V) K++; parent.assign(K, vector(V, -1)); dist.assign(V, -1); dfs(G, root, -1, 0); for (int k = 0; k + 1 < K; k++) { for (int v = 0; v < V; v++) { if (parent[k][v] < 0) { parent[k + 1][v] = -1; } else { parent[k + 1][v] = parent[k][parent[k][v]]; } } } } // 根からの距離と1つ先の頂点を求める void dfs(const Graph &G, int v, int p, int d) { parent[0][v] = p; dist[v] = d; for (auto e : G[v]) { if (e.to != p) dfs(G, e.to, v, d + 1); } } int query(int u, int v) { if (dist[u] < dist[v]) swap(u, v); // u の方が深いとする int K = parent.size(); // LCA までの距離を同じにする for (int k = 0; k < K; k++) { if ((dist[u] - dist[v]) >> k & 1) { u = parent[k][u]; } } // 二分探索で LCA を求める if (u == v) return u; for (int k = K - 1; k >= 0; k--) { if (parent[k][u] != parent[k][v]) { u = parent[k][u]; v = parent[k][v]; } } return parent[0][u]; } ll getdist(int u,int v){ return dist[u]+dist[v]-2*dist[query(u,v)]; } }; ld ans(ll N,ll M,ll K){ //例外をうまいこと処理してこう。 //N==1の時、M個からK個選んで特定のやつを含まない確率は? //M個からK個選んだ時分のM-1個からK個選んだ時=(M-1)!*(M-K)!/(M!*(M-K-1)!) if(N==1){ return max((M-K)/(ld)(M),(ld)0.0); } ld res=0; //甘味があった時 ll eaten=1; eaten+=M*(N-1); if(eaten> N >> M >> K; cout << fixed << setprecision(15) << ans(N,M,K) << endl; } int main(){ ll T=1;cin >> T; while(T--){ solve(); } return 0; }