add a.c
This commit is contained in:
parent
1e8625a06e
commit
e3bb79221e
1 changed files with 43 additions and 0 deletions
43
abc042/a.c
Normal file
43
abc042/a.c
Normal file
|
@ -0,0 +1,43 @@
|
|||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#define ARRAY_SIZE 3
|
||||
|
||||
int compare_number(const void *number1, const void *number2);
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int i;
|
||||
int input_array[ARRAY_SIZE];
|
||||
|
||||
i = 0;
|
||||
while (i < ARRAY_SIZE)
|
||||
{
|
||||
scanf("%d", &input_array[i]);
|
||||
++i;
|
||||
}
|
||||
qsort(input_array, ARRAY_SIZE, sizeof(int), compare_number);
|
||||
if (input_array[0] == 5 && input_array[1] == 5 && input_array[2] == 7)
|
||||
{
|
||||
puts("YES");
|
||||
}
|
||||
else
|
||||
{
|
||||
puts("NO");
|
||||
}
|
||||
}
|
||||
|
||||
int compare_number(const void *number1, const void *number2)
|
||||
{
|
||||
if (*(int *)number1 > *(int *)number2)
|
||||
{
|
||||
return (1);
|
||||
}
|
||||
else if (*(int *)number1 < *(int *)number2)
|
||||
{
|
||||
return (-1);
|
||||
}
|
||||
else
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue