| Run ID | Author | Problem | Lang | Verdict | Score | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|---|
| 12518 | A班-袁誉晏 | 求出N以内的全部素数,并按每行五个数显示 | C++ | Accepted | 100 | 1 MS | 256 KB | 356 | 2025-07-22 09:57:33 |
#include <bits/stdc++.h> using namespace std; int zs(int b) { if(b==1) { return 0; } for(int i=2;i<=sqrt(b);i++) { if(b%i==0) { return 0; } } return 1; } int main() { int a,b=0; cin>>a; for(int i=2;i<=a;i++) { if(zs(i)) { cout<<i<<" "; b++; if (b%5==0) { cout<<endl; } } } }