CF1097B.Petr and a Combination Lock
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Petr has just bought a new car. He's just arrived at the most known Petersburg's petrol station to refuel it when he suddenly discovered that the petrol tank is secured with a combination lock! The lock has a scale of 360 degrees and a pointer which initially points at zero:

Petr called his car dealer, who instructed him to rotate the lock's wheel exactly n times. The i-th rotation should be ai degrees, either clockwise or counterclockwise, and after all n rotations the pointer should again point at zero.
This confused Petr a little bit as he isn't sure which rotations should be done clockwise and which should be done counterclockwise. As there are many possible ways of rotating the lock, help him and find out whether there exists at least one, such that after all n rotations the pointer will point at zero again.
彼得刚刚买了一辆新车。他刚抵达圣彼得堡最著名的加油站为车加油,却突然发现油箱被一个组合锁锁住了!该锁的刻度盘为 360 度,初始时指针指向 0:

彼得立即致电汽车经销商,对方指示他必须恰好旋转锁的转盘 n 次。其中第 i 次旋转的角度为 ai 度,方向可为顺时针或逆时针;且经过全部 n 次旋转后,指针必须再次指向 0。
这令彼得有些困惑,因为他不确定每次旋转究竟该选顺时针还是逆时针方向。由于存在多种可能的旋转方式,请你帮助他判断:是否存在至少一种旋转方案,使得经过全部 n 次旋转后,指针最终恰好指向 0?
输入格式
The first line contains one integer n (1≤n≤15) — the number of rotations.
Each of the following n lines contains one integer ai (1≤ai≤180) — the angle of the i-th rotation in degrees.
第一行包含一个整数 n(1≤n≤15)—— 旋转次数。
接下来的 n 行中,每行包含一个整数 ai(1≤ai≤180)—— 第 i 次旋转的角度(单位:度)。
输出格式
If it is possible to do all the rotations so that the pointer will point at zero after all of them are performed, print a single word "YES". Otherwise, print "NO". Petr will probably buy a new car in this case.
You can print each letter in any case (upper or lower).
如果可以进行所有旋转,使得指针在完成全部旋转后指向零,则输出单个单词 “YES”;否则输出 “NO”。在这种情况下,Petr 很可能会购买一辆新车。
你可以以任意大小写(大写或小写)输出每个字母。
输入输出样例
输入#1
3 10 20 30
输出#1
YES
输入#2
3 10 10 10
输出#2
NO
输入#3
3 120 120 120
输出#3
YES
说明/提示
In the first example, we can achieve our goal by applying the first and the second rotation clockwise, and performing the third rotation counterclockwise.
In the second example, it's impossible to perform the rotations in order to make the pointer point at zero in the end.
In the third example, Petr can do all three rotations clockwise. In this case, the whole wheel will be rotated by 360 degrees clockwise and the pointer will point at zero again.
在第一个例子中,我们可以通过依次顺时针执行第一次和第二次旋转,并逆时针执行第三次旋转来达成目标。
在第二个例子中,无法通过按顺序执行这些旋转,使得指针最终指向零。
在第三个例子中,Petr 可以全部三次旋转均顺时针进行。此时,整个轮盘将顺时针旋转 360 度,指针将再次指向零。
输入解题思路,AI测评打分。不知道怎么写?