|
#include<iostream>
#include<iomanip>
using namespace std;
#define int long long
int l,r,a,b,ans,c[10],d[10];
signed main(){
cin>>l>>r>>a>>b;
for(int i=l;i<=r;i++){
if(i>=a&&i<=b){
ans++;
}
}
if(ans/(r-l+1)==1){
cout<<1;
return 0;
}
int chushu=r-l+1;
for(int i=1;i<=4;i++){
if(i==1){
c[i]=0;
d[i]=ans;
continue;
}
c[i]=d[i-1]*10/chushu;
d[i]=d[i-1]*10-c[i]*chushu;
}
if(c[4]>=5){
c[3]++;
}
cout<<c[1]<<"."<<c[2]<<c[3]<<'\n';
return 0;
}
|
|