

Time Limit: 2 sec / Memory Limit: 1024 MB
配点 : 100 点
問題文
4 個の数字 N_1, N_2, N_3, N_4 が与えられます.これらを並べ替えて 1974 という数字の列を作ることが出来るかを判定してください.
制約
- 0 \leq N_1, N_2, N_3, N_4 \leq 9
- N_1, N_2, N_3, N_4 は整数
入力
入力は以下の形式で標準入力から与えられる.
N_1 N_2 N_3 N_4
出力
N_1, N_2, N_3, N_4 を並べ替えて 1974 という数字の列を作ることが出来るなら YES
を,出来ないなら NO
を出力せよ.
入力例 1
1 7 9 4
出力例 1
YES
N_2 と N_3 を入れ替えると 1974 となります.
入力例 2
1 9 7 4
出力例 2
YES
何もしなくても 1974 となっています.
入力例 3
1 2 9 1
出力例 3
NO
入力例 4
4 9 0 8
出力例 4
NO
Score : 100 points
Problem Statement
You are given four digits N_1, N_2, N_3 and N_4. Determine if these can be arranged into the sequence of digits "1974".
Constraints
- 0 \leq N_1, N_2, N_3, N_4 \leq 9
- N_1, N_2, N_3 and N_4 are integers.
Input
Input is given from Standard Input in the following format:
N_1 N_2 N_3 N_4
Output
If N_1, N_2, N_3 and N_4 can be arranged into the sequence of digits "1974", print YES
; if they cannot, print NO
.
Sample Input 1
1 7 9 4
Sample Output 1
YES
We can get 1974 by swapping N_2 and N_3.
Sample Input 2
1 9 7 4
Sample Output 2
YES
We already have 1974 before doing anything.
Sample Input 3
1 2 9 1
Sample Output 3
NO
Sample Input 4
4 9 0 8
Sample Output 4
NO