## 10852 - Less Prime

Moderator: Board moderators

Antonio Ocampo
Experienced poster
Posts: 131
Joined: Sat Jul 17, 2004 4:09 am
Location: Lima, Per

### 10852 - Less Prime

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
``````

neno_uci
Experienced poster
Posts: 104
Joined: Sat Jan 17, 2004 12:26 pm
Location: Cuba
Your output is ok, according to my AC program..., best wishes,

Yandry.

sumankar
A great helper
Posts: 286
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta
Contact:
My AC code gives out the same thing.

Regards,
Suman.

CDiMa
Experienced poster
Posts: 214
Joined: Fri Oct 17, 2003 5:49 pm
Location: Genova

### Re: 10852: Less Prime

Antonio Ocampo wrote:Hi fellows, could someone give me the output for this inputs ??
Look out for input values under 100.

Ciao!!!

Claudio

Tamagodzi
New poster
Posts: 22
Joined: Thu Apr 28, 2005 10:56 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

CDiMa
Experienced poster
Posts: 214
Joined: Fri Oct 17, 2003 5:49 pm
Location: Genova
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

sumankar
A great helper
Posts: 286
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta
Contact:
Oh really!I never put any such special check though.Guess I was plain lucky.

CDiMa
Experienced poster
Posts: 214
Joined: Fri Oct 17, 2003 5:49 pm
Location: Genova
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

sumankar
A great helper
Posts: 286
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta
Contact:
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?

CDiMa
Experienced poster
Posts: 214
Joined: Fri Oct 17, 2003 5:49 pm
Location: Genova
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

sumankar
A great helper
Posts: 286
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta
Contact:
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

Larry
Guru
Posts: 647
Joined: Wed Jun 26, 2002 10:12 pm
Location: Hong Kong and New York City
Contact:
I got AC without checking for N < 100, do these inputs exist?

Antonio Ocampo
Experienced poster
Posts: 131
Joined: Sat Jul 17, 2004 4:09 am
Location: Lima, Per
At last............ I got AC . I don

ibrahim
Experienced poster
Posts: 149
Joined: Mon Feb 07, 2005 10:28 pm