@[saixingzhe](/user/652816) 我随便调了一下,
```cpp
t[cun]-ts[cun]
```
可能是
```cpp
t[cun]/ts[cun]
```
但是只拿了70分,剩下的你自己努力吧
```cpp
#include<bits/stdc++.h>
using namespace std;
int n,m1,m2,t[450000],ts[450000],s,ti,cun,lastans=2147483647,lastflag,tscun;
int main(){
scanf("%d%d%d",&n,&m1,&m2);
ti=m1;
for(int j=2;j<=sqrt(m1);j++){
int cnt=0;
while(m1%j==0&&m1) cnt++,m1/=j;
t[j]=cnt;
}
if(m1>1) t[m1]=1*m2;
cun=m1;
m1=ti;
for(int j=2;j<=sqrt(m1);j++){
t[j]*=m2;
}
for(int i=1;i<=n;i++){
scanf("%d",&s);
ti=s;
for(int j=2;j<=sqrt(s);j++){
int cnt=0;
while(s%j==0&&m1) cnt++,s/=j;
ts[j]=cnt;
}
if(s>1) ts[s]=1;
tscun=s;
s=ti;
bool flag=0;
int ans=0;
for(int j=2;j<=sqrt(m1);j++){
if(!t[j]) continue;
if(t[j]&&!ts[j]){
flag=1;
break;
}
ans=max(ans,(t[j]-1)/ts[j]);
}
if(cun>1){
if(t[cun]&&!ts[cun]) flag=1;
else ans=max(ans,(t[cun]-1)/ts[cun]);
}
if(tscun>1) ts[tscun]=0;
for(int j=2;j<=sqrt(s);j++) ts[j]=0;
if(!flag) lastflag=1,lastans=(min(lastans,ans));
}
if(!lastflag) printf("-1\n");
else printf("%d\n",lastans+1);
return 0;
}
```
by 北文 @ 2023-04-03 20:35:06
@[saixingzhe](/user/652816) 除法要特判,如果能不整除,要除完后+1,不然会寄,我之前就卡在这~~不过我60分,更惨~~
by fuxuantong123 @ 2023-04-07 22:26:47
@[saixingzhe](/user/652816) 还有,sqrt()常数有点大,建议用i*i的形式
by fuxuantong123 @ 2023-04-07 22:40:33