백준 2057 팩토리얼 분해
문제 : https://www.acmicpc.net/problem/2057
Swift :
var input = Int(readLine()!)!
var res: Int = 2432902008176640000
var ans = "YES"
if !(input != 0){
input = -1
}
for i in stride(from: 20, to: 0, by: -1){
res /= i
if input >= res{
input -= res
}
}
print((input != 0) ? "NO" : "YES")