1006

JinPeng edited 5 年,1 月前

#include <stdio.h>

#define N 1000100

int prime[N]={1}, sum[N]={0};
int n, m;

void init() {
    // assign 1 to all the elements in prime.
    for(int i=2;i<=N-100;i++)prime[i] = 1;

    for(int i=2;i<=N-100;i++) {
        if(prime[i] != 0) {
            for(int j=i+i;j<N-10;j+=i) {
                prime[j] = 0;
            }
        }
    }

}

int main() {
    init();
    while(scanf("%d %d", &n, &m) != EOF) {
        /*
                Your code here.
                */
    }
}

Comments