The First Meeting
Practice
3.3 (26 votes)
Easy
Math
Primality test
Problem
94% Success 9592 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code
Given an array, A, of length N. Find the absolute difference between the smallest and largest prime number in array A.
Input:
First line contains an integer, N, number of points.
Second line contains N space separated integers, \(A_i\), denoting the elements of the array A.
Output:
Print the absolute difference between the smallest and largest prime number in array A, otherwise 1.
Constraints:
\(1 \le N \le 10^6\)
\(1 \le A_i \le 10^6\)
Submissions
Please login to view your submissions
Similar Problems
Points:20
17 votes
Tags:
Ad-HocApprovedBasic ProgrammingEasyImplementationOpen
Points:20
524 votes
Tags:
ApprovedData StructuresEasyHiringSieve
Points:20
8 votes
Tags:
ApprovedEasyHiringMathPrimality testSieve
Editorial