Skip to content

Commit

Permalink
1847 C
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasPLopes committed Dec 23, 2019
1 parent f7bca2e commit 697a954
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions C/1847.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#include <stdio.h>

char *happy = ":)";
char *sad = ":(";

char *smiley(int d[])
{

if (d[0] > d[1] && d[1] <= d[2])
return happy;
if (d[0] < d[1] && d[1] >= d[2])
return sad;
if (d[0] < d[1] && d[1] < d[2] && d[2] - d[1] < d[1] - d[0])
return sad;
if (d[0] < d[1] && d[1] < d[2] && d[2] - d[1] >= d[1] - d[0])
return happy;
if (d[0] > d[1] && d[1] < d[2] && d[2] - d[1] < d[1] - d[0])
return happy;
if (d[0] > d[1] && d[1] >d[2] && d[1] -d[2] < d[0] -d[1] )//
return happy;
if (d[0] > d[1] && d[1] > d[2] && d[1] - d[2] >= d[0] - d[1])
return sad;
if (d[0] == d[1] && d[1] < d[2])
return happy;
if (d[0] == d[1] && d[1] > d[2])
return sad;
if(d[0]== d[1] && d[1]== d[2])
return sad;
}

int main(int argc, char const *argv[])
{
int d[3] = {0, 0, 0};

scanf("%d %d %d", &d[0], &d[1], &d[2]);

printf("%s\n", smiley(d));
return 0;
}

0 comments on commit 697a954

Please sign in to comment.