ACM (UVa) : 10188


// http://uva.onlinejudge.org/external/101/10188.html

#include <stdio.h>
#include <string.h>
#include <ctype.h>

char standard [12100];
char team [12100];
int n;
int m;

bool accepted ()
{
    if ( n != m )
        return false;

    if ( strcmp ( standard, team ) )
        return false;

    return true;
}

bool presentation ()
{
    char temp1 [12100];
    int index = 0;

    for ( int i = 0; standard [i] != 0; i++ ) {
        if( isdigit (standard [i]) )
            temp1 [index++] = standard [i];
    }

    temp1 [index] = 0;
    index = 0;

    char temp2 [12100];

    for ( int i = 0; team [i] != 0; i++ ) {
        if ( isdigit (team [i]) )
            temp2 [index++] = team [i];
    }

    temp2 [index] = 0;

    if ( strcmp (temp1, temp2) == 0 )
        return true;

    return false;
}

int main ()
{
    int run = 0;

    while ( scanf ("%d", &n) && n ) {
        getchar ();

        standard [0] = 0;

        char temp [125];
        for ( int i = 0; i < n; i++ ) {
            gets (temp);
            strcat (standard, temp);
        }

        //printf ("%s\n", standard);

        scanf ("%d", &m);
        getchar ();

        team [0] = 0;

        for ( int i = 0; i < m; i++ ) {
            gets (temp);
            strcat (team, temp);
        }

        //printf ("%s\n", team);

        if ( accepted () )
            printf ("Run #%d: Accepted\n", ++run);
        else if ( presentation () )
            printf ("Run #%d: Presentation Error\n", ++run);
        else
            printf ("Run #%d: Wrong Answer\n", ++run);
    }

    return 0;
}
Advertisements

One thought on “ACM (UVa) : 10188

  1. Critical Input : 
    1
    hello
    2
    hello
    hello
    1
    it is 2009
    2
    it is 20
    09
    1
    
    1
    h
    1
    pakku 105
    1
    105
    1
    tui ekta bekub
    1
    eta kono kotha na
    1
    1ha 2la 3pu
    1
    123
    1
    124
    1
    123
    0
    
    Critical Output :
    Run #1: Presentation Error
    Run #2: Presentation Error
    Run #3: Presentation Error
    Run #4: Presentation Error
    Run #5: Presentation Error
    Run #6: Presentation Error
    Run #7: Wrong Answer
    
    

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s