当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

5594:ZYB's Prime

题目描述
After getting $600$ scores in $NOIP$,$ZYB(ZJ-267)$ creates a problem:you are given $N$ numbers,now you are asked to divide them into $K$ groups($K \geq 1$),the
number of each group must be no less than $3$,and put all the numbers in a group into a ring,the sum of every two adjacent numbers must be a prime.$ZYB$ want to ask
you whether the $N$ numbers can be divided or not?
输入解释
In the first line there is the testcase $T$.

For each teatcase:

In the first line there is one number $N$.
In the next line there are N numbers $A_i$.

$1 \leq T \leq 50$,$1 \leq N \leq 200$,$1 \leq A_i \leq 200$,for $60$% cases $N \leq 20$.
输出解释
For each testcase,print the $YES$ or $NO$.
输入样例
2
7
3 4 8 9 1 1 1
3
1 2 3
输出样例
YES
NO
来自杭电HDUOJ的附加信息
Recommend hujie

该题目是Virtual Judge题目,来自 杭电HDUOJ

题目来源 BestCoder Round #65

源链接: HDU-5594

最后修改于 2020-10-25T23:24:03+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
2000/1000MS(Java/Others) 131072/131072K(Java/Others)