Composite Sequence
Time limit1sMemory limit256 MB
Decide whether some non-empty subsequence of the given positive integers sums to a composite number.
- Level
Medium7 of 10
- Topics
- Math, Number theory, Greedy, Brute force
- Solved
- No attempts yet
Problem
A sequence of positive integers is a composite sequence if and only if there is a non-empty subsequence of such that the sum of all integers in is a composite number.
Given , determine whether is a composite sequence.
is not a composite number.
is a subsequence of if and only if we can obtain by removing some elements of (possibly none or all).
Input
The first line contains a single integer (), the size of .
The second line contains integers : the elements of ().
Output
If is a composite sequence, output Yes. Otherwise, output No.