ACM (UVa) : 11530

If we consecutively use scanf () and gets () then, it may create some input/output problem. For example,
Digit is an integer variable
A is a character array
scanf (“%ld”, & Digit);
gets (A);
printf (“%ld %s”, Digit, A);

Let, the input :

what will be the output ??
output will be just: 12

Basic Solution:
scanf (“%ld”, & Digit);
gets (A);
if (A [0] = end of string ) then gets (A);
printf (“%ld %s”, Digit, A);

Read the whole text as string, then judge each character in the following way:
if, a / d / g / j / m / p / w / <sp> then Count+=1
else if, b / e / h / k / n / q / u / x then Count+=2
else if, c / f / I / l / o / r / v / y then Count+=3
else if, s/ z then Count+=4
Output: Count

Critical input:
united international university
computer and telecommunication engineering

Critical output:
Case #1: 66
Case #2: 82


2 thoughts on “ACM (UVa) : 11530

  1. Critical inputs are based on assumption and do not take any guarantee about code acceptance.
    Your code passes critical cases, that may mean u r very close to get accepted.
    May be, your code contains few silly mistakes and that’s why failed to produce correct output for judge’s entire input.
    you can post your code here as a comment and i will check it for you, if i got the mistake i’ll let u know.
    to do so follow the procedure :

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s