wip
Time Limit: 1 seconds
Memory Limit: 1024 MB
Rating: 1100
Problem StatementZion needs to get back into his spaceship, but forgot his password! However, he has written down a list of integers (of length $n$) that contains his password which is hidden inside. The password is the longest consecutive sequence of prime numbers in the list - the order/positions of the numbers stay constant. What is the length of his password?
InputThe first line contains an integer, $n$ where $1 ≤ n ≤ 1000$, the number of integers in the list. The second line contains $n$ space-separated integers, which can range from $-1000$ to $1000$.
OutputOutput a single integer representing the length of the longest consecutive sequence of prime numbers.
Sample CasesSample Input 0: 9 2 4 6 2 1 3 5 3 2 Sample Output 0: 4Explanation
The longest consecutive sequence of prime numbers is $[3,5,3,2]$ so the output is 4. $2$ is a prime number and $1$ is not.
SourcesKL Coding Cup October 2024 > Problem 12
Submit | Back