问题2919--Get X points

2919: Get X points

[命题人 : ]
时间限制 : 1.000 sec  内存限制 : 64 MB

题目描述

We all know the game called 24 points which let us calculate 24 by 4 number with "+ - * / ans ( )". Now the problem is more difficult you must calculate X(1<=X<=100) points with N(3<=N<=5) numbers the rule is the same as 24 points. To make the problem a little easier, you just need to determine whether we can make it.

输入

There are several test cases.Each line is a test case. Each test case begin with X and N,then N number followed, the N numbers are between 1 and 15.(All numbers are integers)

输出

if we can get X points by the N numbers then output "YES"; otherwise out put "NO";

样例输入 Copy

30 5 3 4 5 4 1

样例输出 Copy

YES

提示

4 * 4 + 3 * 5 - 1 = 30

来源/分类

tyh