F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

ZYB's Prime

Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)
Total Submission(s): 278    Accepted Submission(s): 69


Problem Description
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?
 

Input
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$.
 

Output
For each testcase,print the $YES$ or $NO$.
 

Sample Input
2 7 3 4 8 9 1 1 1 3 1 2 3
 

Sample Output
YES NO
 

Source
 

Statistic | Submit | Discuss | Note
Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-04-20 01:39:39, Gzip enabled