The Next PrimeProblem code: AD1 |
All submissions for this problem are available.
Prime number one of the simplest concept in our childhood and comes under the basics of maths . Now, cody's teacher has taught him the prime number concept and he decided to have some fun with it.
Cody knows that
" a prime number is a natural number that has exactly two distinct natural number divisors: 1 and itself"
Now, to check if he has learnt the prime number concept, he picked randomly a number n and if the number is prime then "YEAH" or else "NAA" and he has to find next 10 prime numbers
Input
The first line contains t, the number of test cases (1<=t<=10000). Followed by t lines which contain values of n(1 <=n <= 10^12)
Output
For every test case if n is a prime number print "YEAH" or else print "NAA" and print 10 successive prime numbers separated by a single space.
Example
Input: 3 19 63 23497. Output: YEAH NAA 67 71 73 79 83 89 97 101 103 107 YEAH
| Date: | 2010-02-27 |
| Time limit: | 0.5s |
| Source limit: | 50000 |
| Languages: | C C99 strict C++ 4.0.0-8 C++ 4.3.2 PAS gpc PAS fpc JAVA NICE JAR C# C#2 NEM ST ASM D FORT ADA BASH PERL PYTH RUBY LUA ICON PIKE PHP SCM guile SCM qobi LISP sbcl LISP clisp SCALA HASK ERL CAML CLPS PRLG WSPC BF ICK JS |
Comments

Fetching successful submissions

please justify the SPACE
please justify the SPACE between ouputs of two cases .............
Hello Admin, I just submitted
Hello Admin, I just submitted my solution for this problem in JAVA. It seems to work fine with all the example test cases. But when I submitted it, I got an error which said Time Limit Exceeded. Is there any way to fix this ? Thanks in advance!!
- Rahul
@abhishek after every test
@abhishek
after every test case there should be an empty line
@rahul
please check your solution for all the numbers falling in the above mentioned range, not for the test cases
@rahul please check your
@rahul
please check your solution for all the numbers falling in the above mentioned range, not for the test cases only......
Please post all your doubts
Please post all your doubts here or mail it to algothika.algochallenge@gmail.com
ALGOTHIKA ORGANIZER
Nirley Gupta
Join us also on
Join us also on facebook
ALGOTHIKA
@admin please check the test
@admin please check the test data. I am getting correct output for test case 1-50 and 999999999950-1000000000000
The test cases are
The test cases are right...............
Are u really serious with the
Are u really serious with the time limit ?
10000 cases and n going upto 10^12 ?
kindly check the test cases
kindly check the test cases
@admin kindly check ur all
@admin kindly check ur all data of test cases ..............
@admin plzzzzz check the
@admin plzzzzz check the input
The inputs are
The inputs are correct.....
@abhijth
yes, we are serious and u can also see the problem solved in just 0.08 sec..
The inputs are
The inputs are correct.....
@abhijth
yes, we are serious and u can also see the problem solved in just 0.08 sec..
I am pretty sure there is
I am pretty sure there is something wrong with the test data. Can you please re-check ?
The test data is
The test data is right......
Someone has already solved it........
I thought, that someone is
I thought, that someone is Admin, whose source code is the judge solution :).
Still, Is everything alright with this one ? Output format, Input ?.
I think u r having real
I think u r having real problems with this question............
please mail me ur solution algothika.algochallenge@gmail.com
I have already mailed it long
I have already mailed it long time Back. Probably you din't check the mail ?
Got it, we will get back to u
Got it, we will get back to u asap.......
Okay, Thanks.
Okay, Thanks.
Can you please specify, if
Can you please specify, if there is a space at the end of the tenth prime number.
And also if there is a blank line after the last input.
@Yash The problem has been
@Yash
The problem has been rectified.....
@Kunal
there is a space after a tenth number and a blank line after the last output............
Hey, i have a doubt about the
Hey, i have a doubt about the output screen. Is this correct? Please tell me whether there is a space or line required or to be removed. Thanks!!
3
19
YEAH
63
NAA
67 71 73 79 83 89 97 101 103 107
23497
YEAH
@Rahul There should be a
@Rahul
There should be a single space between the numbers and there is an empty line after every test case....
your test case is write if these conditions are satisfied
For the above mentioned, it looks write
@Nirley : Can u please
@Nirley : Can u please provide some large test cases to check whether the code works properly for really big numbers.
@Rahul The test cases are
@Rahul
The test cases are right for this program, we have already received successful submissions for this problem and has been verified also......
hey.. m not able 2 submit my
hey.. m not able 2 submit my code.. it is giving a compiler error,, dat class prm is public and thus be named as public.java!!
@Shubhank Please
@Shubhank
Please visit
http://www.codechef.com/wiki/sample-solutions#Java
i did that.. still am not
i did that.. still am not able to submit.
@Shubank please use only
@Shubank
please use only class main
@nirley.. Tried dat as well..
@nirley..
Tried dat as well.. still not working..
Check all your header
Check all your header files.........if someone is missing
well.. it is getting compiled
well.. it is getting compiled in my laptop.. so i dunt think der's ne problem wid d code..
which compiler r u
which compiler r u using??.....
JDK 6.. bt JDK 5 will also
JDK 6.. bt JDK 5 will also compile it without any error i guess.. not much difference is their amongst the 2 unless u r using GUI which i am not..
mail ur code
mail ur code to algothika.algochallenge@gmail.com and we will get back to u........
i did dat.. abt an hour ago..
i did dat.. abt an hour ago..
my program is working for all
my program is working for all the test cases and for big nos also
bt it is saying wrong answer ..
please help me out??
@Khyati Please check your
@Khyati
Please check your algorithm for smalll number and large numbers...... itz not right
its working correctly for
its working correctly for small number and large nos as well ....
i hv checked it again and again
help me.....
rply...
rply...
@Khyati mail me ur program to
@Khyati
mail me ur program to algothika.algochallenge@gmail.com
i hv sent u the
i hv sent u the mail......thanks
tl me wat was wrong with my
tl me wat was wrong with my code??
@Khyati As i told u earlier
@Khyati
As i told u earlier there is a little basic mistake in ur program
We cannot correct ur code under the rules and regulations of contest...
But still check all your loops........