Thursday, 19 May 2011

acm 11547-Automatic Answer

#include<stdio.h>
int main()
{
    register int t,n;
    //freopen("in.txt","r",stdin);
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d",&n);
        n=(315*n+36962)/10;
        n%=10;
        if(n<0)
            n=~n+1;//for converting positive
        printf("%d\n",n);
    }
    return(0);
}

No comments:

Post a Comment

Post a Comment