#include<stdio.h>
int digSum(int);
int main()
{
char boy[30],girl[30],ch;
int bw,gw,i;
double per;
// freopen("in.txt","r",stdin);
while(gets(boy))
{
gets(girl);
bw=gw=0;
for(i=0;boy[i];i++)
{
ch=boy[i]&95;//ch=boy[i]-22;
if(ch>=65&&ch<=90)
bw=bw+ch-64;
}
for(i=0;girl[i];i++)
{
ch=girl[i]&95;//ch=boy[i]-22;
if(ch>=65&&ch<=90)
gw=gw+ch-64;
}
while(bw>=10)
bw=digSum(bw);
while(gw>=10)
gw=digSum(gw);
if(bw>gw)
per=(gw*100.0)/bw;
else
per=(bw*100.0)/gw;
printf("%0.2lf %c\n",per,37);
}
return 0;
}
int digSum(int n)
{
int sum=0;
while(n)
{
sum=sum+n%10;
n=n/10;
}
return sum;
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.