10852 - Less Prime

All about problems in Volume 108. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

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

10852 - Less Prime

Post by Antonio Ocampo » 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
Thx in advance :D

neno_uci
Experienced poster
Posts: 104
Joined: Sat Jan 17, 2004 12:26 pm
Location: Cuba

Post by neno_uci » Thu May 26, 2005 5:59 am

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:

Post by sumankar » Thu May 26, 2005 6:02 am

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

Post by CDiMa » 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

Tamagodzi
New poster
Posts: 22
Joined: Thu Apr 28, 2005 10:56 pm

Post by Tamagodzi » 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 ;)

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

Post by CDiMa » 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

sumankar
A great helper
Posts: 286
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta
Contact:

Post by sumankar » Thu May 26, 2005 12:39 pm

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

Post by CDiMa » 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

sumankar
A great helper
Posts: 286
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta
Contact:

Post by sumankar » 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?

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

Post by CDiMa » 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

sumankar
A great helper
Posts: 286
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta
Contact:

Post by sumankar » 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 :wink:

Larry
Guru
Posts: 647
Joined: Wed Jun 26, 2002 10:12 pm
Location: Hong Kong and New York City
Contact:

Post by Larry » Thu May 26, 2005 5:31 pm

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

Post by Antonio Ocampo » Fri May 27, 2005 1:28 am

At last............ I got AC :D. I don

User avatar
ibrahim
Experienced poster
Posts: 149
Joined: Mon Feb 07, 2005 10:28 pm
Location: Northern University, Bangladesh
Contact:

Post by ibrahim » 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 ?

ThanhNhan
New poster
Posts: 15
Joined: Sun Aug 08, 2004 12:24 am

10852 input

Post by ThanhNhan » Thu Aug 18, 2005 5:29 am

That the input for p10852 contains n < 100 is incorrect. Shouldn't it be fixed ?

Post Reply

Return to “Volume 108 (10800-10899)”