Submit | All submissions | Best solutions | Back to list |
ISPRIME - Prime or not |
Wersja polska | English version | Deutsche Fassung |
Your task is to check whether x is prime.
Input
There is unknown number of tests. Each test consist of one integer x (x<=2*109).
Output
For each test print YES is x is prime or NO otherwise.
Example
Input: 1
2
3
4
5
Output: NO
YES
YES
NO
YES
Added by: | Piotr Kąkol |
Date: | 2010-08-23 |
Time limit: | 4.820s-9.819s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: NODEJS OBJC SCM qobi VB.NET |
Resource: | Copy of Roman Sol's task PON with different scoring and languages |
hide comments
|
||||||
2012-04-27 05:20:41 Devil D
My CODE for PON is running fine.. same code here gives error ... |
||||||
2011-06-02 15:45:14 Hallvard Norheim Bø
@Alex: it's either that, or iterate over sys.stdin. If you choose the first solution, you must wrap it in a try/except clause, since the judge requires your program to complete without throwing an exception. |
||||||
2011-06-02 14:26:47 Alex
How do i realize the unknown test cases? Just with a "while true"? |
||||||
2011-01-07 00:19:26 Piotr KÄ…kol
Sorry once again for giving You hope. |
||||||
2011-01-06 17:06:10 Hallvard Norheim Bø
Bad news for my base-2 pseudoprime test in 54 bytes of Python... |
||||||
2011-01-06 13:17:40 Piotr KÄ…kol
No. // I added test with Carmichael numbers as I noticed that I haven't put them into this task while solving PON. I made rejudge so some of AC are now WA or TLE. Sorry for the confusion. |
||||||
2011-01-06 12:25:57 Hallvard Norheim Bø
Can x be negative or zero in the tests? Last edit: 2011-01-06 12:26:29 |
||||||
2010-11-15 12:05:58 HWK
Thank you! That helped a lot. |
||||||
2010-11-14 10:31:35 Piotr KÄ…kol
Sorry for misleading You. I used "Page down" button to compare Your results with correct ones and when scrollbar reach the bottom I thought that You print wrong answer for mentioned below tests and the real mistake is... that You don't printf answer for the last test unless it's followed by EOL. ;-) |
||||||
2010-11-14 09:48:41 HWK
That's strange. Exactly this results I get at home (Bash 4.1.5(1) on Ubuntu 10.04) with 4294099 and 4294029!? |