#include #include #include #include #include using namespace std ; using ll = long long ; int main() { int n, k, ct ; cin >> n >> k >> ct ; cout << setprecision(15) ; vector p(n) ; vector t(n) ; for (int i=0; i> p[i] >> t[i] ; vector sc(n) ; vector pc(n) ; vector sel(n) ; for (int i=n-k; i> sortme ; for (int r=0; r tp(ct+1) ; tp[0] = 1 ; for (int i=0; i<(int)sortme.size(); i++) { int r = sortme[i].second ; for (int tt=ct-1; tt>=0; tt--) { if (tp[tt] == 0) continue ; double pp = tp[tt] ; tp[tt] = pp * (1-p[r]) ; if (tt + t[r] <= ct) { tp[tt + t[r]] += pp * p[r] ; sc[r] += pp * p[r] ; } } } } while (next_permutation(sel.begin(), sel.end())) ; for (int i=0; i