1 条题解

  • 0
    @ 2025-4-12 21:33:30

    C++ :

    #include<iostream>
    #include<cstring>
    using namespace std;
    bool a[10005];
    int main(){
    	memset(a,true,sizeof(a));
    	for (int i=2; i<=100; i++)
    		if (a[i])
    			for (int j=2*i; j<=10000; j+=i)
    				a[j]=false;
    	int t=0;
    	for (int i=2; i<=10000; i++)
    		if (a[i]){
    			cout<<i;
    			t++;
    			if (t%10==0) cout<<endl;
    			else cout<<" ";
    		}
    	cout<<endl;
    	return 0;
    }
    
    • 1

    信息

    ID
    175
    时间
    1000ms
    内存
    128MiB
    难度
    (无)
    标签
    递交数
    0
    已通过
    0
    上传者