11530 - SMS Typing

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

Moderator: Board moderators

jaime21
New poster
Posts: 6
Joined: Wed Apr 09, 2014 4:36 pm

Re: 11530 - SMS Typing

Post by jaime21 » Wed Apr 09, 2014 4:42 pm

Can anyone give some sample test cases? That would be real helpful! :)

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11530 - SMS Typing

Post by brianfry713 » Wed Apr 09, 2014 8:55 pm

Try running your code on the sample input.
Check input and AC output for thousands of problems on uDebug!

jaime21
New poster
Posts: 6
Joined: Wed Apr 09, 2014 4:36 pm

Re: 11530 - SMS Typing

Post by jaime21 » Thu Apr 10, 2014 8:40 am

@brianfry713 I did!! The output is the the same.

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11530 - SMS Typing

Post by brianfry713 » Thu Apr 10, 2014 8:29 pm

Check input and AC output for thousands of problems on uDebug!

samsj
New poster
Posts: 2
Joined: Tue Jul 15, 2014 1:22 pm

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

Post by samsj » Tue Jul 15, 2014 1:43 pm

http://ideone.com/fnbbmb whats wrong with this? please anyone help :(

lighted
Guru
Posts: 585
Joined: Wed Jun 11, 2014 9:56 pm
Location: Kyrgyzstan, Bishkek

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

Post by lighted » Tue Jul 15, 2014 2:57 pm

Change this

Code: Select all

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

Code: Select all

scanf("%d", &n);
while(getchar() != '\n') ;
A person who sees the good in things has good thoughts. And he who has good thoughts receives pleasure from life... Bediuzzaman

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

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

Post by brianfry713 » Tue Jul 15, 2014 8:16 pm

As lighted pointed out, your code won't work if the second line begins with a space.
Check input and AC output for thousands of problems on uDebug!

samsj
New poster
Posts: 2
Joined: Tue Jul 15, 2014 1:22 pm

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

Post by samsj » Wed Jul 16, 2014 2:15 pm

yeah! i got it.. thanks guys.. :)

ehsanulbigboss
New poster
Posts: 32
Joined: Tue Jul 22, 2014 1:17 am

11530 - SMS Typing

Post by ehsanulbigboss » Mon Jul 28, 2014 6:26 pm

{'O''K'}
Last edited by ehsanulbigboss on Thu Aug 14, 2014 4:22 pm, edited 1 time in total.

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11530 - SMS Typing

Post by brianfry713 » Mon Jul 28, 2014 8:02 pm

There is a newline char after T
Check input and AC output for thousands of problems on uDebug!

Xenon Kfr
New poster
Posts: 13
Joined: Tue Nov 18, 2014 1:14 am

Re: 11530 - SMS Typing

Post by Xenon Kfr » Wed Jan 28, 2015 1:15 am

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;
}

brianfry713
Guru
Posts: 5947
Joined: Thu Sep 01, 2011 9:09 am
Location: San Jose, CA, USA

Re: 11530 - SMS Typing

Post by brianfry713 » Thu Jan 29, 2015 2:21 am

Don't use scanf(" "); on line 12. Try adding a getline() after you read T.
Check input and AC output for thousands of problems on uDebug!

Post Reply

Return to “Volume 115 (11500-11599)”