No.431 Death Flags
Problem Statement
You are given the states of 3 death flags and 1 survival flag.
Determine whether the result is death or survival. The determination is made as follows.
- If 2 or more death flags are raised, the result is death; if fewer than 2 are raised, the result is survival.
- If the survival flag is raised, the result is survival regardless of the states of the death flags.
Input
$D_1$ $D_2$ $D_3$ $S$
$D_i\,$ is the state of death flag $\,i\,$ and $S\,$ is the state of the survival flag; each is given as $1\,$ or $\,0\,$.
$1\,$ means ON (the flag is raised) and $0\,$ means OFF (the flag is not raised).
Output
Print "DEAD" in the case of death and "SURVIVED" in the case of survival.
Print a newline at the end.
Sample
Sample 1
Input
0 1 0 0
Output
SURVIVED
Fewer than 2 death flags are raised, so the result is survival.
Sample 2
Input
1 1 1 0
Output
DEAD
2 or more death flags are raised, so the result is death.
Sample 3
Input
1 0 1 1
Output
SURVIVED
The survival flag is raised, so the result is survival regardless of the states of the death flags.
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
くれちー
小指が強い人