6 solutions
-
1
相当炸裂啊
#include<bits/stdc++.h> using namespace std; const int N=1e5+6; int prime[N]; bool vis[N]; int k=0; int seive() { memset(vis,true,sizeof(vis)); vis[0]=vis[1]=false; for(int i=2;i<N;i++) { if(vis[i]) prime[k++]=i; for(int j=0;i<k;j++) { if(i*prime[j]>N) break; vis[i*prime[j]]=false; if(!i%prime[j])break; } } return k; } int main() { seive(); int n; cin>>n; for(int i=0;i<k;i++) { if(n%prime[i]==0) { printf("%d",n/prime[i]); break; } } return 0; }
Information
- ID
- 44
- Time
- 1000ms
- Memory
- 256MiB
- Difficulty
- 7
- Tags
- # Submissions
- 999
- Accepted
- 238
- Uploaded By