- 阶乘的和
#include <iostream>
#include <unordered_set>
using namespace std;
unordered_set<int> S;
int main()
{int f[11];f[0] = 1;for (int i = 1; i < 10; i++){f[i] = f[i - 1] * i;}for (int i = 1; i < 1 << 10; i++){int s = 0;for (int j = 0; j < 10; j++){if (i >> j & 1)s += f[j];}S.insert(s);}int n;while (cin >> n, n>=0){if (S.count(n))cout << "YES" << endl;elsecout << "NO" << endl;}return 0;
}