Page 3 of 3

Re: 11530 - SMS Typing

Posted: Wed Apr 09, 2014 4:42 pm
by jaime21
Can anyone give some sample test cases? That would be real helpful! :)

Re: 11530 - SMS Typing

Posted: Wed Apr 09, 2014 8:55 pm
by brianfry713
Try running your code on the sample input.

Re: 11530 - SMS Typing

Posted: Thu Apr 10, 2014 8:40 am
by jaime21
@brianfry713 I did!! The output is the the same.

Re: 11530 - SMS Typing

Posted: Thu Apr 10, 2014 8:29 pm
by brianfry713

Re: 11530 - sms typing -- Why WA???? :(

Posted: Tue Jul 15, 2014 1:43 pm
by samsj
http://ideone.com/fnbbmb whats wrong with this? please anyone help :(

Re: 11530 - sms typing -- Why WA???? :(

Posted: Tue Jul 15, 2014 2:57 pm
by lighted
Change this

Code: Select all

scanf(" %d ", &n);
This way is more safe

Code: Select all

scanf("%d", &n);
while(getchar() != '\n') ;

Re: 11530 - sms typing -- Why WA???? :(

Posted: Tue Jul 15, 2014 8:16 pm
by brianfry713
As lighted pointed out, your code won't work if the second line begins with a space.

Re: 11530 - sms typing -- Why WA???? :(

Posted: Wed Jul 16, 2014 2:15 pm
by samsj
yeah! i got it.. thanks guys.. :)

11530 - SMS Typing

Posted: Mon Jul 28, 2014 6:26 pm
by ehsanulbigboss
{'O''K'}

Re: 11530 - SMS Typing

Posted: Mon Jul 28, 2014 8:02 pm
by brianfry713
There is a newline char after T

Re: 11530 - SMS Typing

Posted: Wed Jan 28, 2015 1:15 am
by Xenon Kfr
why WA ?i dont understand

Code: Select all

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int t;
    string array1="adgjmptw ",array2="behknqux",array3="cfilorvy";
    string s;
    cin>>t;
    int c=1;
    for(int i=0; i<t; i++)
    {
        scanf(" ");
        getline(cin,s);
        int sum=0;
        for(int j=0; s[j]; j++)
        {
            for(int k=0; k<9; k++)
                if(s[j]==array1[k])
                {
                    sum += 1;
                    break;
                }
            for(int k=0; k<8; k++)
                if(s[j]==array2[k])
                {
                    sum += 2;
                    break;
                }
             for(int k=0; k<8; k++)
                if(s[j]==array3[k])
                {
                    sum += 3;
                    break;
                }
            if(s[j]=='s' || s[j]=='z')
                sum += 4;
        }
        printf("Case #%d: %d\n",c++,sum);

    }
    return 0;
}

Re: 11530 - SMS Typing

Posted: Thu Jan 29, 2015 2:21 am
by brianfry713
Don't use scanf(" "); on line 12. Try adding a getline() after you read T.