Submit | All submissions | Best solutions | Back to list |
ISPRIME - Prime or not |
Wersja polska | English version | Deutsche Fassung |
Twoim zadaniem jest sprawdzić czy dana liczba x jest liczbą pierwszą.
Wejście
Wejście składa się z nieznanej liczby testów. Każdy z nich zawiera jedną liczbę x (x<=2*109).
Wyjście
Dla każdego testu wypisz YES jeśli x jest liczbą pierwszą lub NO w przeciwnym wypadku.
Przykład
Wejście: 1
2
3
4
5
Wyjście: 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
|
||||||
2014-07-17 02:56:41 Hallvard Norheim Bø
@Piotr: Python 2.7 needs rejudge, my 90b solution doesn't actually work under 2.7. |
||||||
2014-05-31 10:14:06 [Lakshman]
@Piotr Kąkol Why my python solution WA. I have checked this code ON Classical PON and got AC. Last edit: 2014-05-31 10:34:59 |
||||||
2013-12-01 18:22:43 Piotr KÄ…kol
Sure. 0 is not a prime number. |
||||||
2013-12-01 13:39:24 Linghui Liu
@Piotr Kąkol, can you tell me what's the matter with 10570102? I tested all below 10^6, and just used a simple algorithm. |
||||||
2013-04-26 22:03:45 Piotr KÄ…kol
@Quang Linh @arijit - Both of you read number of tests, when there's no such a number. |
||||||
2013-04-15 03:19:31 Quang Linh
I can't understand why my code doesn't work. Please tell me why it has been wrong answer. Thanks! |
||||||
2013-01-06 15:08:37 arijit pande
Can x be negative/zero also? PON code won't work here, I think... |
||||||
2012-10-25 19:17:21 Piotr KÄ…kol
1999999999 is not a prime. |
||||||
2012-10-24 21:07:23 its_time_to_code
please tell me about the wrong answer of my code. |
||||||
2012-05-05 18:06:31 Piotr KÄ…kol
@Devil D - For some Carmichael numbers You print "YES". |