10852 - Less Prime

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

Moderator: Board moderators

10852 - Less Prime

Postby 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
Antonio Ocampo
Experienced poster
 
Posts: 131
Joined: Sat Jul 17, 2004 4:09 am
Location: Lima, Per

Postby neno_uci » Thu May 26, 2005 5:59 am

Your output is ok, according to my AC program..., best wishes,

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

Postby sumankar » Thu May 26, 2005 6:02 am

My AC code gives out the same thing.

Regards,
Suman.
sumankar
A great helper
 
Posts: 288
Joined: Tue Mar 25, 2003 8:36 am
Location: calcutta

Re: 10852: Less Prime

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

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

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

Postby sumankar » Thu May 26, 2005 12:39 pm

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

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

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

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

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

Postby Larry » Thu May 26, 2005 5:31 pm

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

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

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

Postby 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 ?
User avatar
ibrahim
Experienced poster
 
Posts: 149
Joined: Mon Feb 07, 2005 10:28 pm
Location: Northern University, Bangladesh

10852 input

Postby ThanhNhan » Thu Aug 18, 2005 5:29 am

That the input for p10852 contains n < 100 is incorrect. Shouldn't it be fixed ?
ThanhNhan
New poster
 
Posts: 15
Joined: Sun Aug 08, 2004 12:24 am

Next

Return to Volume CVIII

Who is online

Users browsing this forum: No registered users and 1 guest