Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
54338 | zhangweiran | 第n小的质数 | C++ | Accepted | 0 MS | 256 KB | 430 | 2024-10-27 10:42:12 |
#include<bits/stdc++.h> using namespace std; int main(){ int n, s = 0; cin >> n; for(int i = 2;;i++){ bool a = 1; for(int j = 2; j <= int(sqrt(i)); j++){ if(i % j == 0){ a = 0; break; } } if(a){ s++; } if(s == n){ cout << i << endl; return 0; } } return 0; }