Cod sursa(job #245002)
Utilizator | Data | 16 ianuarie 2009 14:19:49 | |
---|---|---|---|
Problema | Cifre | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva de probleme | Marime | 0.47 kb |
#include<stdio.h>
int n,i,k,m,a,b,s,l;
void read()
{scanf("%d%d%d%d",&n,&m,&a,&b);
}
int cifre(int x)
{
int cf=0;
while(x)
{ if(x%10==b)
cf++;
x/=10;
}
return cf;
}
void solve()
{
for(i=n;i<=m;i++)
if(cifre(i)>=a)
s++;
}
int main ()
{
freopen("cifre.in","r",stdin);
freopen("cifre.out","w",stdout);
read();
solve();
float p;
p=(float)s/(m-n+1);
printf("%.4f\n",p);
return 0;
}