//...................SUBHASHIS MOLLICK...................///
///.....DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING....///
///.............ISLAMIC UNIVERSITY,BANGLADESH.............///
///....................SESSION-(14-15)....................///
#include<bits/stdc++.h>
using namespace std;
#define sf(a) scanf("%lld",&a)
#define sf2(a,b) scanf("%lld %lld",&a,&b)
#define sf3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define pf(a) printf("%lld",a)
#define pf2(a,b) printf("%lld %lld",a,b)
#define pf3(a,b,c) printf("%lld %lld %lld",a,b,c)
#define nl printf("\n")
#define ll long long
#define pb push_back
#define MPI map<int,int>mp;
#define fr(i,n) for(i=0;i<n;i++)
#define fr1(i,n) for(i=1;i<=n;i++)
#define frl(i,a,b) for(i=a;i<=b;i++)
//freopen("Input.txt","r",stdin);
//freopen("Output.txt","w",stdout);
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1}; // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1}; // Kings Move
//const int fx[]={-2, -2, -1, -1, 1, 1, 2, 2}; // Knights Move
//const int fy[]={-1, 1, -2, 2, -2, 2, -1, 1}; // Knights Move
main()
{
long long n,m,p,q;
while(cin>>n>>m>>p>>q)
{
double ans=1.0,i=2.0,j=2.0,max_nm,max_pq,min_nm,min_pq;
min_nm=min(m,(n-m));
max_nm=max(m,(n-m))+1;
min_pq=min(q,(p-q));
max_pq=max(q,(p-q))+1;
while(max_nm<=n||max_pq<=p||i<=min_nm||j<=min_pq)
{
if(max_nm<=n)
{
ans*=max_nm;
}
if(max_pq<=p)
{
ans/=max_pq;
}
if(i<=min_nm)
{
ans/=i;
}
if(j<=min_pq)
{
ans*=j;
}
max_nm++;
max_pq++;
i++;
j++;
}
printf("%.5f\n",ans);
}
}
///.....DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING....///
///.............ISLAMIC UNIVERSITY,BANGLADESH.............///
///....................SESSION-(14-15)....................///
#include<bits/stdc++.h>
using namespace std;
#define sf(a) scanf("%lld",&a)
#define sf2(a,b) scanf("%lld %lld",&a,&b)
#define sf3(a,b,c) scanf("%lld %lld %lld",&a,&b,&c)
#define pf(a) printf("%lld",a)
#define pf2(a,b) printf("%lld %lld",a,b)
#define pf3(a,b,c) printf("%lld %lld %lld",a,b,c)
#define nl printf("\n")
#define ll long long
#define pb push_back
#define MPI map<int,int>mp;
#define fr(i,n) for(i=0;i<n;i++)
#define fr1(i,n) for(i=1;i<=n;i++)
#define frl(i,a,b) for(i=a;i<=b;i++)
//freopen("Input.txt","r",stdin);
//freopen("Output.txt","w",stdout);
//const int fx[]={+1,-1,+0,+0};
//const int fy[]={+0,+0,+1,-1};
//const int fx[]={+0,+0,+1,-1,-1,+1,-1,+1}; // Kings Move
//const int fy[]={-1,+1,+0,+0,+1,+1,-1,-1}; // Kings Move
//const int fx[]={-2, -2, -1, -1, 1, 1, 2, 2}; // Knights Move
//const int fy[]={-1, 1, -2, 2, -2, 2, -1, 1}; // Knights Move
main()
{
long long n,m,p,q;
while(cin>>n>>m>>p>>q)
{
double ans=1.0,i=2.0,j=2.0,max_nm,max_pq,min_nm,min_pq;
min_nm=min(m,(n-m));
max_nm=max(m,(n-m))+1;
min_pq=min(q,(p-q));
max_pq=max(q,(p-q))+1;
while(max_nm<=n||max_pq<=p||i<=min_nm||j<=min_pq)
{
if(max_nm<=n)
{
ans*=max_nm;
}
if(max_pq<=p)
{
ans/=max_pq;
}
if(i<=min_nm)
{
ans/=i;
}
if(j<=min_pq)
{
ans*=j;
}
max_nm++;
max_pq++;
i++;
j++;
}
printf("%.5f\n",ans);
}
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন