#include <string.h>
int main()
{
char a[30],b[30],c='%';
int i,j,sum,r,t,l,l1,r1,t1,sum1,f,g;
double m;
while(gets(a))
{
gets(b);
sum=0;
sum1=0;
f=1;
g=1;
for(i=0;i<strlen(a);i++)
{
if(a[i]>='A' && a[i]<='Z')
{
sum=sum+a[i]-64;
}
if(a[i]>='a' && a[i]<='z')
{
sum=sum+a[i]-96;
}
}
for(j=0;j<strlen(b);j++)
{
if(b[j]>='A' && b[j]<='Z')
{
sum1=sum1+b[j]-64;
}
if(b[j]>='a' && b[j]<='z')
{
sum1=sum1+b[j]-96;
}
}
r=sum;
while(1)
{
if(r<10)
{
break;
f=0;
}
else
{
l=0;
}
while(r!=0 &&f!=0)
{
t=r%10;
l=l+t;
r=r/10;
}
r=l;
}
r1=sum1;
while(1)
{
if(r1<10)
{
break;
g=0;
}
else
{
l1=0;
}
while(r1!=0 && g!=0)
{
t1=r1%10;
l1=l1+t1;
r1=r1/10;
}
r1=l1;
}
if(l>l1)
{
m=((double)l1/(double)l);
}
else
{
m=((double)l/(double)l1);
}
printf("%0.2lf %c\n",m*100,c);
}
return 0;
}
0 comments:
Post a Comment