Submit | All submissions | Best solutions | Back to list |
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
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 |
hide comments
|
||||||||||||||
2011-03-21 08:51:50 Endang Wahyu Pamungkas
what the answer if input=1.?? |
||||||||||||||
2011-02-26 20:04:59 Armin A¹imoviæ
Weak test cases. Two iterations with Little Fermat's Theorem :) |
||||||||||||||
2010-12-26 15:03:17 sandeep pandey
yes..weak test cases!!!! got accepted wd 1 iteration wd miller rabin... |
||||||||||||||
2010-12-23 16:49:12 VinyleEm
Input isn't properly formatted. I take this occasion to reiterate that problem setters shall format their input files properly and also state the proper input format in the statement. |
||||||||||||||
2010-12-20 15:09:09 Tommy Anandra
what is the formula that can be check until 2^63? |
||||||||||||||
2010-11-17 10:37:19 :D
The question was asked below. Use "long long" or "unsigned long long" in c++, "long" in java. |
||||||||||||||
2010-11-17 10:08:16 tirta
How to store an integer of range 2^63-1 ? |
||||||||||||||
2010-09-19 13:20:35 .:: Jarv1s ::.
yeah very very weak test cases! My algorithm has been ranked 60th Last edit: 2010-09-19 13:22:34 |
||||||||||||||
2010-06-04 06:04:04 Ankul Garg
Weak test cases!!! |
||||||||||||||
2009-10-23 06:10:15 Seshadri R
@krishna kant Use unsigned long long t; printf("%llu", t) for printing t's value |