WA加TLE,求解,

P1075 [NOIP2012 普及组] 质因数分解

```c 试求出两者中较大的那个质数 ``` 质数两个字要加粗
by Zachary_zhong @ 2023-07-13 16:59:12


```c for(int i=1;i<=n;i++) ``` n->sqrt(n)
by Zachary_zhong @ 2023-07-13 17:02:34


@[15093432132cqt](/user/1010865) ```c #include<bits/stdc++.h> using namespace std; int sum,n,maxx=-1; inline bool pd(int x) { for(int i=2;i<=sqrt(x);i++) if(x%i==0) return 0; return 1; } int main() { cin>>n; for(int i=1;i<=sqrt(n);i++) if(n%i==0) if(pd(n/i)) maxx=max(maxx,n/i); cout<<maxx; } ```
by Zachary_zhong @ 2023-07-13 17:03:26


谢谢
by 15093432132cqt @ 2023-07-14 13:32:03


|