Welcome To SDIBT ACM-ICPC Online Judge

VIRTUAL JUDGE Recent Contest F.A.Qs Discuss Home ProblemSet Status Ranklist Contest LoginRegister Exam
Problem 1002. -- 用筛法求之N内的素数。(程序填空)

用筛法求之N内的素数。(程序填空)

Time Limit: 1 Sec  Memory Limit: 64 MB
Submit: 2539  Solved: 627
[Submit][Status][Discuss]

Description

用筛法求之N内的素数。

提交时只要提交填空部分即可。

#include <stdio.h>
void prim(int n){
    int i,j,a[n]; 
    for(i=2;i<n;i++) 
    {   a[i]=i; 
        for(j=2;j<=i;j++) 
        {
          ————————
             
        
    }  
}
int main() 
    int  a;
    scanf("%d",&a);
    prim(a);
    return 0;
}

Input

N (N<=200)

Output

0~N的素数

Sample Input

100

Sample Output

2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
53
59
61
67
71
73
79
83
89
97

HINT

Source

[Submit][Status][Discuss]

HOME Back

한국어 中文 English
All Copyright Reserved 2008-2010 SDIBT TEAM
GPL2.0 2003-2010 HUSTOJ Project TEAM
Anything about the Problems, Please Contact Admin:admin