#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define ios std::ios_base::sync_with_stdio(false); #define ll long long #define pb push_back #define fi(ss) freopen (ss,"r",stdin) #define fo(ss) freopen (ss,"w",stdout) #define sz(v) ((int)((v).size())) #define all(x) (x).begin(),(x).end() #define REP(i, v) for(int i=0;i pii; typedef pair tri; int n,l; const int maxSum = 25005; int s[60]; double fac[60]; double dp1[maxSum][60]; double dp2[maxSum][60]; // set back dp int main() { fac[0] = 1; for (int i = 1 ; i < 60 ; ++i) { fac[i] = 1.0*i * fac[i - 1]; } scanf("%d %d",&n,&l); ll sum = 0; l*=60; int x,y; for (int i = 0 ; i < n ; ++i) { scanf("%d:%d",&x,&y); s[i]=x*60+y; sum+=s[i]; } if (l >= sum) { return printf("%d\n",n); } dp1[0][0] = 1; for (int i = 0 ; i < n ; ++i) { for (int j = i; j >= 0 ; --j) { for (int cur = 0; cur <= maxSum ; ++cur) { dp1[min(maxSum,cur + s[i])][j + 1] += 1.0*dp1[cur][j]; } } } double ways = 0.0; for (int i = 0 ; i < n ; ++i) { for (int j = 0 ; j <= n ; ++j) { for (int cur = 0 ; cur < l ;++cur) { dp2[cur][j] = dp1[cur][j]; if (cur - s[i] >= 0 && j >= 1) { dp2[cur][j] -= dp2[cur - s[i]][j - 1]; } if (j < n && cur + s[i] >= l) { ways += 1.0*(j+1)*(((dp2[cur][j] * 1.0*fac[j] * fac[n - j - 1]))); } } } } printf("%.15lf\n",ways/fac[n]); }