Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<string.h>
- #include<iomanip>
- #include<cstdio>
- using namespace std;
- int main()
- {
- char a[30],b[30];
- double love;
- while(!cin.eof())
- {
- gets(a);
- gets(b);
- int aaa=0,bbb=0,i,aa,bb,sum1,sum2;
- aa=strlen(a);
- bb=strlen(b);
- for(i=0; i<aa; i++)
- {
- if(isalpha(a[i]))
- {
- if('a'<= a[i] && a[i]<='z')
- {
- aaa+=(a[i]-96);
- }
- else
- {
- aaa+=(a[i]-64);
- }
- }
- }
- for(i=0; i<bb; i++)
- {
- if(isalpha(b[i]))
- {
- if('a'<=b[i] && b[i]<='z')
- {
- bbb+=(b[i]-96);
- }
- else
- {
- bbb+=(b[i]-64);
- }
- }
- }
- aaa=((aaa-1)%9)+1;
- bbb=((bbb-1)%9)+1;
- if(aaa>=bbb)
- {
- love=((double)bbb/(double)aaa)*100;
- printf("%.2lf %%\n",love);
- }
- else
- {
- love=((double)aaa/(double)bbb)*100;
- printf("%.2lf %%\n",love);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement