Run ID | Author | Problem | Lang | Verdict | Time | Memory | Code Length | Submit Time |
---|---|---|---|---|---|---|---|---|
41036 | liusiyu | 找素数(蓝桥杯2012决赛第1题) | C++ | Time Limit Exceeded | 1000 MS | 612 KB | 338 | 2024-02-18 19:51:31 |
#include<bits/stdc++.h> using namespace std; bool sushu(int n){ for(int i=2;i<n/2;i++){ if(n%i==0) return false; } return true; } int main() { int a[100005]={}; int cnt=0,m=1; while(1){ m++; if(sushu(m)){ a[cnt]=m; cnt++; } if(cnt==100002){ cout<<a[cnt]; break; } } return 0; }