UVA Solution 11547 – Automatic Answer

Editorial:
Actually I was facing the problem how can make the second digit from the left that named as tens column.

So I did this algorithm.

1.First made the steps for n
2. Then made the n divided by 10 and take only the pure value no fraction
3. Then made the pure value divided with 10 as we want to find out the 10th’s coloumns
4. Then for the negative I used the absolute value builtin function.

Reference:
https://saicheems.wordpress.com/2013/11/15/uva-11547-automatic-answer/

Code:

#include<iostream>
#include<bits/stdc++.h>
int main()
{

    int test_case,n,i;
    while((scanf("%d",&test_case)==1))
    {
        for(i=0; i<test_case; i++)
        {
            scanf("%d",&n);
            n=n*567;
            n=n/9;
            n+=7492;
            n*=235;
            n/=47;
            n=n-498;
            n/=10;
            n%=10;
            n=abs(n);
            printf("%d\n",n);
        }
    }
    return 0;
}

 

It would be a great help, if you support by sharing :)
Author: zakilive

Leave a Reply

Your email address will not be published. Required fields are marked *