Search Here

Wednesday, May 6, 2015

UVa - 12502 ( Three Family Solution )

Tip : Try Yourself First . For Help Scroll Down .

Code 


#include<stdio.h>
#include<math.h>
int main()
{
    int t,result,a, b, c;
    scanf("%d",&t);
    while(t--)
    {
        scanf("%d %d %d",&a,&b,&c);
        result= c*((2*a)-b)/(a+b);
        if(result<=0)
            printf("0\n");
        else
           printf("%d\n", result);
    }
    return 0;
}

=> Questions ?? Leave a Comment .

No comments:

Post a Comment