UVa Solution 11547 – Automatic Answer


The problem link is
 UVa:11547-Automatic Answer

Solution:

#include<stdio.h>
#include<string.h>
int main()
{
    int test_case,n,i,tmp;
    char str[10];
    scanf("%d",&test_case);
    for(i=0;i<test_case;i++)
    {
        scanf("%d",&n);
        tmp = (((n * 63)+7492)*5)-498;
        sprintf(str,"%d",tmp/10);
        printf("%c\n",str[strlen(str)-1]);
    }
    return 0;
}

Run time: 0.012
User Name on UVA: refatsardar

Advertisements

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 )

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

%d bloggers like this: