PON - Prime or Not
Given the number, you are to answer the question: "Is it prime?"
Solutions to this problem can be submitted in C, C++, Pascal, Perl, Python, Ruby, Lisp, Hask, Ocaml, Prolog, Whitespace, Brainf**k and Intercal only.
Input
t – the number of test cases, then t test cases follows. [t <= 500]
Each line contains one integer: N [2 <= N <= 2^63-1]
Output
For each test case output string "YES" if given number is prime and "NO" otherwise.
Example
Input: 5 2 3 4 5 6 Output: YES YES NO YES NO
hide comments
PubLic_AvenGeR:
2012-03-06 19:08:41
Finally after 33 submissions...... :))
|
|
libra:
2012-02-05 11:06:06
test cases are not proper!!i printed NO for 2,3,5 it accepted!!! |
|
Laplace:
2012-01-22 21:21:00
GOt accepted by 1 iteration with miller rabin...algo |
|
manish kapoor:
2012-01-22 17:34:08
6384521
|
|
Jitesh:
2011-11-05 12:59:34
what max size of char array we can take on spoj.....can any one help???? |
|
vit:
2011-08-16 14:01:13
ha again. my code get tle for 9223372036854775783, but ac in system |
|
vit:
2011-08-16 09:05:06
ha. my code write YES for 49141 and get AC... |
|
Pranay:
2011-08-15 22:46:42
solovay-strassen times out?? |
|
Rohan Kalra:
2011-05-14 01:53:16
Very weak test cases. Only 1 iteration of Miller–Rabin required -_- |
|
Neeraj Bhat:
2011-05-04 12:21:40
for Endang wahyu pamungkas: n(2<=n<=2^63-1)
|
Added by: | Roman Sol |
Date: | 2005-01-24 |
Time limit: | 21s |
Source limit: | 5000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ADA95 ASM32 BASH CSHARP CLPS D ERL FORTRAN ICON JAVA JS-RHINO LUA NEM NICE PHP PIKE ST |
Resource: | ZCon 2005 |