Sunday, April 24, 2016

UVA 10550 - Combination Lock : Solution

Unknown
#include <stdio.h>
int main()
{
    int i,a,b,c,deg,temp;
    while (scanf("%d%d%d%d",&i,&a,&b,&c)==4)
    {
        if (i==0 &&a==0 && b==0 && c==0) break;
        deg=1080;
        temp=i-a;
        if (temp<0) temp=temp+40;
        deg+=temp*9;
        temp=b-a;
        if (temp<0) temp=temp+40;
        deg+=temp*9;
        temp=b-c;
        if (temp<0) temp=temp+40;
        deg+=temp*9;
        printf("%d\n",deg);
    }
    return 0;
}

Unknown

Studying at Shahjalal University of Science and Technology, Sylhet.

0 comments:

Post a Comment

Coprights @ 2016,