Saturday, July 15, 2017

URI problem 1847 solution in C | (Welcome to the Winter!)

#include<stdio.h>
int main()
{
    int a,b,c;
    while(scanf("%d",&a)!=EOF){
        scanf("%d %d",&b,&c);
        if(a>b && b<=c)printf(":)\n");
        else if(a<b && b>=c)printf(":(\n");
        else if(a<b && b<c && (b-a)>(c-b))printf(":(\n");
        else if(a<b && b<c && (b-a)<=(c-b))printf(":)\n");
        else if(a>b && b>c && (a-b)>(b-c))printf(":)\n");
        else if(a>b && b>c && (a-b)<=(b-c))printf(":(\n");
        else if(a==b){
                if(b<c)printf(":)\n");
                else printf(":(\n");
        }
    }
    return 0;
}

No comments:

Post a Comment