#include <iostream>
#include<cstdio>
#include<cstring>
using namespace std;
double fun(int s1,int s2)
{
while(s1>9)
{
int res=0;
while(s1)
{
res+=(s1%10);
s1/=10;
}
s1=res;
}
while(s2>9)
{
int res=0;
while(s2)
{
res+=(s2%10);
s2/=10;
}
s2=res;
}
// cout<<s1<<" "<<s2<<endl;
double r;
if(s1<s2)
{
r=(double)s1/(double)s2;
r*=100;
}
else if(s1>s2)
{
r=(double)s2/(double)s1;
r*=100;
}
else
{
r=100.00;
}
return r;
}
int main()
{
string s1,s2;
while(getline(cin,s1))
{
getline(cin,s2);
int l1=s1.size();
int l2=s2.size();
int sum1=0,sum2=0;
for(int i=0; i<l1; i++)
{
if((s1[i]>='a'&&s1[i]<='z')||(s1[i]>='A'&&s1[i]<='Z'))
{
if (s1[i]>='a'&&s1[i]<='z') sum1+=(s1[i]-96);
if(s1[i]>='A'&&s1[i]<='Z') sum1+=(s1[i]-64);
}
}
for(int i=0; i<l2; i++)
{
if((s2[i]>='a'&&s2[i]<='z')||(s2[i]>='A'&&s2[i]<='Z'))
{
if (s2[i]>='a'&&s2[i]<='z') sum2+=(s2[i]-96);
if(s2[i]>='A'&&s2[i]<='Z') sum2+=(s2[i]-64);
}
}
// cout<<sum1<<sum2<<endl;
char x='%';
double res=fun(sum1,sum2);
printf("%.2lf %c\n",res,x);
}
return 0;
}
#include<cstdio>
#include<cstring>
using namespace std;
double fun(int s1,int s2)
{
while(s1>9)
{
int res=0;
while(s1)
{
res+=(s1%10);
s1/=10;
}
s1=res;
}
while(s2>9)
{
int res=0;
while(s2)
{
res+=(s2%10);
s2/=10;
}
s2=res;
}
// cout<<s1<<" "<<s2<<endl;
double r;
if(s1<s2)
{
r=(double)s1/(double)s2;
r*=100;
}
else if(s1>s2)
{
r=(double)s2/(double)s1;
r*=100;
}
else
{
r=100.00;
}
return r;
}
int main()
{
string s1,s2;
while(getline(cin,s1))
{
getline(cin,s2);
int l1=s1.size();
int l2=s2.size();
int sum1=0,sum2=0;
for(int i=0; i<l1; i++)
{
if((s1[i]>='a'&&s1[i]<='z')||(s1[i]>='A'&&s1[i]<='Z'))
{
if (s1[i]>='a'&&s1[i]<='z') sum1+=(s1[i]-96);
if(s1[i]>='A'&&s1[i]<='Z') sum1+=(s1[i]-64);
}
}
for(int i=0; i<l2; i++)
{
if((s2[i]>='a'&&s2[i]<='z')||(s2[i]>='A'&&s2[i]<='Z'))
{
if (s2[i]>='a'&&s2[i]<='z') sum2+=(s2[i]-96);
if(s2[i]>='A'&&s2[i]<='Z') sum2+=(s2[i]-64);
}
}
// cout<<sum1<<sum2<<endl;
char x='%';
double res=fun(sum1,sum2);
printf("%.2lf %c\n",res,x);
}
return 0;
}
কোন মন্তব্য নেই:
একটি মন্তব্য পোস্ট করুন