Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
46096 | liusiyu | 找素数(蓝桥杯2012决赛第1题) | C++ | Accepted | 260 MS | 240 KB | 291 | 2024-04-24 21:11:13 |
#include<bits/stdc++.h> using namespace std; bool pd(int x){ for(int i=2;i*i<=x;i++){ if(x%i==0) return 0; } return 1; } int main() { int cnt=0; for(int i=2;;i++){ if(pd(i)==1){ cnt++; if(cnt==100002){ cout<<i; return 0; } } } return 0; }