Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
46095 | liusiyu | 第n小的质数 | C++ | Accepted | 1 MS | 252 KB | 341 | 2024-04-24 21:08:27 |
#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 a[10001]; int main() { int n,cnt=0; cin>>n; for(int i=2;i<100001;i++){ if(pd(i)==1){ cnt++; if(cnt==n){ cout<<i; return 0; } else a[cnt]=i; } } return 0; }