Page 2 of 3

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

Posted: Fri Oct 22, 2010 2:50 pm
by ruhul_sust
I m new in uva forum.Next time i'll follow ur advise. Thanks 4 ur advise.

But I m still in problem with this easy problem.I could not find any solution in any previous post .
I m frustrated :0
please help me.

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

Posted: Sat Oct 23, 2010 8:57 am
by sohel
gets() after scanf() will not work.

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

Posted: Wed Oct 27, 2010 7:54 pm
by ruhul_sust
i can't understand what u say.
gets() does not do any work means ?????

I try scanf rather using gets() but still WA!!!!
:(((((
hELp ME ... :'( :( :( :( :(

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

Posted: Wed Oct 27, 2010 10:26 pm
by ruhul_sust
thanks I got my Error and i fix it now && got AC....... :D :) :lol:

Re: 11530 - sms typing -- Why WA???? Please help me

Posted: Mon Dec 06, 2010 9:08 pm
by Mizanur Rahman(IUK)

Code: Select all

#include<iostream.h>
#include<stdio.h>

int main()
{
	long int i,n,count;
	char a;
	cin>>n;
	for(i=0;i<n;i++)
	{
		count=0;
		a=getchar();
		while(a!='\n')
		{
			if(a=='a'||a=='d'||a=='g'||a=='j'||a=='m'||a=='p'||a=='t'||a=='w'||a==' ')
				count=count+1;
			else if(a=='b'||a=='e'||a=='h'||a=='k'||a=='n'||a=='q'||a=='u'||a=='x')
				count=count+2;
			else if(a=='c'||a=='f'||a=='i'||a=='l'||a=='o'||a=='r'||a=='v'||a=='y')
				count=count+3;
			else if(a=='s'||a=='z')
				count=count+4;
			a=getchar();
		}
		printf("Case #%ld: %ld\n",i+1,count);
		//cout<<"Case #"<<i+1<<": "<<count;
		//cout<<endl;
	}
	return 0;
}

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

Posted: Tue May 03, 2011 3:43 pm
by anik.bit0104

Code: Select all

#include <iostream>
#include <stdio.h>
#include <cstring>
using namespace std;

int posFinder(char c);

int main()
{
  int numOfTestCases;
  string s;
  int sumOfPos=0;
  int caseCounter=0;
  char dummy;

 scanf("%d%c",&numOfTestCases,&dummy);

  for (int i=0;i<numOfTestCases ;i++ )
    {
      caseCounter++;

      getline(cin,s);

      for (int i=0;i<s.size() ;i++ )
        {
          sumOfPos=sumOfPos+posFinder(s[i]);
        }
        cout<<"Case #"<<caseCounter<<": "<<sumOfPos<<endl;
        sumOfPos=0;

    }

  return 0;
}

int posFinder(char c)
{

  char one[8]={'a','d','g','j','m','p','t','w'};
  char two[8]={'b','e','h','k','n','q','u','x'};
  char three[8]={'c','f','i','l','o','r','v','y'};
  char four[2]={'s','z'};

  if (strchr(one,c)!=NULL || c==' ') return 1;
  else if (strchr(two,c)!=NULL) return 2;
  else if (strchr(three,c)!=NULL) return 3;
  else if (strchr(four,c)!=NULL) return 4;

}
I don't know where am i failing.. help me?

11530 help

Posted: Tue Apr 03, 2012 12:58 pm
by zahid0055
Help me finding the error of my code

Code: Select all

#include<stdio.h>
#include<string.h>
int main()
{
    char s[101];
    int t,i,j,count=0;
    scanf("%d\n",&t);

    for(i=0;i<t;i++)
    {

        gets(s);
        int len=strlen(s);
        for(j=0;j<len;j++)
        {
        if(s[j]==' '||s[j]=='a'||s[j]=='d'||s[j]=='g'||s[j]=='j'||s[j]=='m'||s[j]=='p'||s[j]=='t'||s[j]=='w'||s[j]==' ')
        count=count+1;
        else if(s[j]=='b'||s[j]=='e'||s[j]=='h'||s[j]=='k'||s[j]=='n'||s[j]=='q'||s[j]=='u'||s[j]=='x')
        count=count+2;
        else if(s[j]=='c'||s[j]=='f'||s[j]=='i'||s[j]=='l'||s[j]=='o'||s[j]=='r'||s[j]=='v'||s[j]=='y')
        count=count+3;
        else if(s[j]=='s'||s[j]=='z')
        count=count+4;
        }
        printf("Case #%d: %d\n",i+1,count);
        count=0;
    }

    return 0;
}
getting Wrong Answer
Help me with some test cases

Re: 11530 help

Posted: Wed Apr 04, 2012 1:28 am
by brianfry713
Input:

Code: Select all

3

welcome to ulab
good luck and have fun
AC output:

Code: Select all

Case #1: 0
Case #2: 29
Case #3: 41

Re: 11530

Posted: Sun Oct 21, 2012 6:16 pm
by EROR
In the Problem Statement here http://uva.onlinejudge.org/index.php?op ... oblem=2525 there is a line containing
Each line will contain at least 1 and at most 100 characters.
. But in the input there may be some inputs where the string is blank. may be one of blank string starts the input file. Can the site update this problems.......??????????
:oops:

WA: 11530 Why????

Posted: Tue Feb 25, 2014 9:18 pm
by me33
I think everything is okay. but continuously getting WA.
plz help me. :( :cry:

my code.

Code: Select all

Removed After AC

Re: WA: 11850

Posted: Tue Feb 25, 2014 9:41 pm
by brianfry713
That doesn't look like the correct problem number
Don't use fflush(stdin);

Re: WA: 11530 Why????

Posted: Wed Feb 26, 2014 4:14 pm
by me33
Sorry! My mistake.

The problem number is 11530

Re: WA: 11530 Why????

Posted: Thu Feb 27, 2014 12:42 am
by brianfry713
Don't use fflush(stdin);

Re: WA: 11530 Why????

Posted: Fri Feb 28, 2014 1:43 am
by me33
How can I take input in this loop???
Plz help

Re: 11530 - SMS Typing

Posted: Wed Apr 09, 2014 4:39 pm
by jaime21
Hello! I need help!! UVA keeps telling me runtime error! Can't find the bug

Code: Select all

import java.util.*;

class Main{
	
	public static void main(String[] args){
		Scanner sc = new Scanner(System.in);
		int i, tc, j, sum;
		char c;
		String input;
		
		tc = sc.nextInt();
		sc.nextLine();
		sc.nextLine();
		for(i=1; i<=tc; i++){
			input = sc.nextLine();
			sum = 0;
			for(j=0; j<input.length(); j++){
				c = input.charAt(j);
				if( c=='a' || c=='d' || c=='g' || c=='j' || c=='m' || c=='p' || c=='t' || c=='w' || c==' ' ){
					sum += 1;
				}
				else if( c=='b' || c=='e' || c=='h' || c=='k' || c=='n' || c=='q' || c=='u' || c=='x' ){
					sum += 2;
				}
				else if( c=='c' || c=='f' || c=='i' || c=='l' || c=='o' || c=='r' || c=='v' || c=='y' ){
					sum += 3;
				}
				else if( c=='s' || c=='z' ){
					sum += 4;
				}
			}
			System.out.format("Case #%d: %d\n", i, sum);
		}
}
	
}