11279 - Keyboard Comparison

All about problems in Volume 112. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

Post Reply
sudipta
New poster
Posts: 11
Joined: Wed Sep 30, 2009 7:23 pm
Location: Sylhet

11279 - Keyboard Comparison

Post by sudipta »

Getting W.A. Whats the problem?

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;
}
Don't Copy, Think Also

plamplam
Experienced poster
Posts: 150
Joined: Fri May 06, 2011 11:37 am

Re: 11279 - Keyboard Comparison

Post by plamplam »

Stupid problem. I would really recommend not to waste your time on this shit. Try this input if you're stuck:

Code: Select all

~`12?><":{}+_)|';\\//&^%$#@(){}~~~!

Code: Select all

129.01 258.38 260.73
You tried your best and you failed miserably. The lesson is 'never try'. -Homer Simpson

Post Reply

Return to “Volume 112 (11200-11299)”