Code: Select all
#include<string.h>
#include<stdio.h>
int main()
{
char key[]={'`','1','2','3','4','5','6','7','8','9','0','-','=','\\','Q','W','E','R','T','Y','U','I','O','P','[',']','A','S','D','F','G','H','J','K','L',';','\'','Z','X','C','V','B','N','M',',','.','/','~','!','@','#','$','%','^','&','*','(',')','_','+','|','{','}',':','"','<','>','?'};
char text[1010];
float q2[]={4.472136,4.00,4.00,4.00,4.00,4.472136, 4.472136, 4.00, 4.00, 4.00, 4.00, 4.472136, 5.6568542, 6.32456, 2.00, 2.00, 2.00, 2.00, 2.828427, 2.828427, 2.00,2.00, 2.00, 2.00, 2.828427, 4.472136, 0.00, 0.00, 0.00,0.00,2.00,2.00,0.00,0.00,0.00,0.00,2.00,2.00,2.00,2.00,2.00,2.828427, 2.828427,2.00,2.00, 2.00, 2.00,4.472136,4.00, 4.00, 4.00, 4.00, 4.472136, 4.472136, 4.00, 4.00, 4.00, 4.00, 4.472136, 5.6568542, 6.32456,2.828427,4.472136, 0.00, 2.00, 2.00, 2.00, 2.00 };
float q1[]={8.94427,7.21111,5.6568542,4.472136,4.00,4.00,4.00,4.00,4.472136,5.6568542,7.21111,8.94427,10.77032,12.16552,6.32456,4.472136,2.828427,2.00,2.00,2.00,2.00,2.828427,4.472136,6.32456,8.246211,10.198039,6.00,4.00,2.00,0.00,0.00,0.00,0.00,2.00,4.00,6.00,8.00,6.32456,4.472136,2.828427,2.00,2.00,2.00,2.00,2.828427,4.472136,6.32456,8.94427,7.21111,5.6568542, 4.472136, 4.00, 4.00, 4.00, 4.00,4.472136, 5.6568542, 7.21111,8.94427,10.77032, 12.16552,8.246211,10.198039,6.00, 8.00, 2.828427,4.472136, 6.32456};
float d[]={10.77032,8.94427,7.21111,5.6568542,8.246211,6.32456,4.472136,8.00,6.00,4.00,8.246211,6.00,8.246211,10.198039,4.472136,2.00,0.00,2.00,0.00,2.828427,2.00,2.00,2.00,4.472136,7.21111,8.94427,2.00,2.00,0.00,4.00,2.828427,0.00,4.00,4.00,4.00,6.32456,4.472136,6.32456,4.472136,2.00,2.00,4.472136,2.00,4.00,2.828427,2.828427,5.6568542,10.77032,8.94427,7.21111,5.6568542,8.246211,6.32456,4.472136,8.00,6.00,4.00,8.246211,6.00,8.246211,10.198039,7.21111,8.94427,6.32456,4.472136,2.828427,2.828427,5.6568542};
int len,i,j,k;
float qw1,qw2,dv;
while(gets(text))
{
len=strlen(text);
qw1=qw2=dv=0;
for(i=0;i<len;i++)
{
for(j=0;j<68;j++)
{
if(text[i]>='a' && text[i]<='z') text[i]-=32;
if(text[i]==key[j])
{
qw1+=q1[j];
qw2+=q2[j];
dv+=d[j];
break;
}
}
}
printf("%.2f %.2f %.2f\n",qw2,qw1,dv);
}
return 0;
}