524 - Prime Ring Problem
Moderator: Board moderators
-
- Learning poster
- Posts: 68
- Joined: Fri Oct 26, 2001 2:00 am
- Location: Dhaka, Bangladesh
- Contact:
524 - Prime Ring Problem
hi,
i recently solved problem 524, actually i am not satisfied with my timing at all. my first timing was 3.160...not it downs to 1.360....but the still its over 1.000....so give me some suggestion..
at first i used the brute force method of finding out primes(that is diving continously till square root of the number)..and got 3.160
then i decided to generate a list of primes at the begining of the program....in generating the list at first i used sieve of iratosthinis method...and got 1.400 timing
then i used the general mehod of prime fining, the difference is i only divide the number with the primes till that number's square root
and then i got 1:360
how can i do much better?
i recently solved problem 524, actually i am not satisfied with my timing at all. my first timing was 3.160...not it downs to 1.360....but the still its over 1.000....so give me some suggestion..
at first i used the brute force method of finding out primes(that is diving continously till square root of the number)..and got 3.160
then i decided to generate a list of primes at the begining of the program....in generating the list at first i used sieve of iratosthinis method...and got 1.400 timing
then i used the general mehod of prime fining, the difference is i only divide the number with the primes till that number's square root
and then i got 1:360
how can i do much better?
524 Prime Ring Problem
In my program..
when a input number is 16, long output lines are printed.
But.. I think it is correct.
Is there any body solved this problem?
How many output lines in 16 number?
[/b][/i]
when a input number is 16, long output lines are printed.
But.. I think it is correct.
Is there any body solved this problem?
How many output lines in 16 number?
[/b][/i]
Re: 524 Prime Ring Problem
rury wrote:In my program..
when a input number is 16, long output lines are printed.
But.. I think it is correct.
Is there any body solved this problem?
How many output lines in 16 number?
[/b][/i]
My program gave 81024 lines.
GGG
What about other inputs ?
Here is outputs from my AC program :
May be this will help ! ![:roll:](./images/smilies/icon_rolleyes.gif)
Here is outputs from my AC program :
Code: Select all
2 : 1
4 : 2
6 : 2
8 : 4
10 : 96
12 : 1024
14 : 2880
16 : 81024
![:roll:](./images/smilies/icon_rolleyes.gif)
I have exactly this amount of output, but I get "Wrong answer" anyway. I don't understand what's wrong.Robbie wrote:What about other inputs ?
Here is outputs from my AC program :May be this will help !Code: Select all
2 : 1 4 : 2 6 : 2 8 : 4 10 : 96 12 : 1024 14 : 2880 16 : 81024
-
- Experienced poster
- Posts: 187
- Joined: Wed Dec 11, 2002 2:03 pm
- Location: Mount Papandayan, Garut