Page 1 of 2

10852 - Less Prime

Posted: Thu May 26, 2005 5:06 am
Hi fellows, could someone give me the output for this inputs ??

Input

Code: Select all

``````10
100
10000
503
101
9999
997
412
586
777
8764
``````
My Output

Code: Select all

``````53
5003
257
53
5003
499
211
307
389
4391
``````

Posted: Thu May 26, 2005 5:59 am
Your output is ok, according to my AC program..., best wishes,

Yandry.

Posted: Thu May 26, 2005 6:02 am
My AC code gives out the same thing.

Regards,
Suman.

Re: 10852: Less Prime

Posted: Thu May 26, 2005 11:16 am
Antonio Ocampo wrote:Hi fellows, could someone give me the output for this inputs ??
Look out for input values under 100.

Ciao!!!

Claudio

Posted: Thu May 26, 2005 12:04 pm
I dont think that the data set has inputs below 100

just take care of inputs like 106

output must be greater than 53

Posted: Thu May 26, 2005 12:30 pm
Tamagodzi wrote:I dont think that the data set has inputs below 100

just take care of inputs like 106

output must be greater than 53
I think it has...

Ciao!!!

Claudio

Posted: Thu May 26, 2005 12:39 pm
Oh really!I never put any such special check though.Guess I was plain lucky.

Posted: Thu May 26, 2005 1:53 pm
sumankar wrote:Oh really!I never put any such special check though.Guess I was plain lucky.
My solution could behave badly for n=0,1,2 so I put an assert for n>99 and got a SIGABRT.
Simply removing the assert got AC although I didn't check if my solution was correct for such low values...

Ciao!!!

Claudio

Posted: Thu May 26, 2005 2:23 pm
I dont know, but I'll assume we use different algorithms and for badly formed input we'll throw up different stuff, so there's not much chance that the judge solution can match them.Can you post your code...if you want to us
have a look?

Posted: Thu May 26, 2005 2:44 pm
sumankar wrote:I dont know, but I'll assume we use different algorithms and for badly formed input we'll throw up different stuff, so there's not much chance that the judge solution can match them.Can you post your code...if you want to us
have a look?
Basically I take the half of the input number and search the prime number next to it. For small numbers you have to assume wether 1 is prime or not, leading to different solutions based on the assumption.

Ciao!!!

Claudio

Posted: Thu May 26, 2005 3:05 pm
CDiMa wrote: Basically I take the half of the input number and search the prime number next to it. For small numbers you have to assume wether 1 is prime or not, leading to different solutions based on the assumption.
Yeah!I was hoping against hope that we differ.We don't

Posted: Thu May 26, 2005 5:31 pm
I got AC without checking for N < 100, do these inputs exist?

Posted: Fri May 27, 2005 1:28 am
At last............ I got AC . I don

Posted: Sun Aug 07, 2005 5:38 am
I can't understand what the question is trying. Can anybody please explain it ?
How can 101 output is 53 ?

10852 input

Posted: Thu Aug 18, 2005 5:29 am
That the input for p10852 contains n < 100 is incorrect. Shouldn't it be fixed ?