| Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
|---|---|---|---|---|---|---|---|---|
| 39169 | Songgr | 找素数(蓝桥杯2012决赛第1题) | C++ | Accepted | 273 MS | 244 KB | 483 | 2024-01-30 20:06:22 |
#include<bits/stdc++.h> using namespace std; bool isPrime(int n) { if(n <= 1) { return false; } int sqr = (int)sqrt(1.0 * n); for(int i = 2; i <= sqr; i++) { if(n % i == 0) { return false; } } return true; } int main() { int num = 5; int cnt = 2; while(1) { if(isPrime(num)) { cnt++; num++; } else { num++; } if(cnt == 100002) { cout << num - 1 << endl; break; } } return 0; }