Friday, 15 January 2016

Solution of URI 1847 :: Welcome to the Winter!


Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.

/**Bismillahir Rahmanir Rahim.**/

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

2 comments:

  1. whats wrong with my code bro?
    #include

    using namespace std;

    int main()
    {
    int a,b,c;
    cin>>a>>b>>c;

    if(a>b && c>=b){
    cout<<":)"<a && c<=b){
    cout<<":("<a && c>b && (b-a)>(c-b)){
    cout<<":("<a && c>b && (b-a)<=(c-b)){
    cout<<":)"<(b-c)){
    cout<<":)"<b){
    cout<<":)"<<endl;
    }
    else if (b==a && c<b){
    cout<<":("<<endl;
    }
    return 0;
    }

    ReplyDelete
  2. #include

    using namespace std;

    int main()
    {
    int a,b,c;
    cin>>a>>b>>c;

    if(a>b && c>=b){
    cout<<":)"<a && c<=b){
    cout<<":("<a && c>b && (b-a)>(c-b)){
    cout<<":("<a && c>b && (b-a)<=(c-b)){
    cout<<":)"<(b-c)){
    cout<<":)"<b){
    cout<<":)"<<endl;
    }
    else if (b==a && c<b){
    cout<<":("<<endl;
    }
    return 0;
    }

    whats wrong with my code? sorry about the first comment.

    ReplyDelete

Note: only a member of this blog may post a comment.