Search found 2 matches

by esmitt
Fri Aug 19, 2005 4:29 am
Forum: Volume 5 (500-599)
Topic: 543 - Goldbach's Conjecture
Replies: 109
Views: 41133

Accepted 543

I got AC.
I was wrong my fill ( ) function.

Code: Select all

void fill() //sieve
{
   memset(isprime,1,sizeof(bool)*N);

   for(uint i = 2; i < N; i++)
   {
      if(isprime[i])
         for(uint k = (i<<1); k < N; k+=i)
            isprime[k] = false;
   }
}
by esmitt
Thu Aug 18, 2005 8:00 am
Forum: Volume 5 (500-599)
Topic: 543 - Goldbach's Conjecture
Replies: 109
Views: 41133

543 WA, i need help

It's my first post.
This problems is WA !!!, but I cannot find the wrong.
Please help me

Thanks in advance.


#include <stdio.h>
#include <memory.h>

#define N 1000001
bool isprime[N];
typedef unsigned int uint;

void fill() //sieve
{
memset(isprime,1,sizeof(bool)*N);

for(uint i = 2; i < N; i ...

Go to advanced search