hack
3 1 1 17 1 2 1 3
在处理权值时要注意权值是质数的情况
int f1(int x){ int res=1; for(int i=2;i*i<=x;i++){ int cnt=0; while(x%i==0){ x/=i; cnt++; } if(cnt%2!=0){ res*=i; } } res *= x; return res; }
在x除完后还有剩余要乘到res中(代码13行),不然x中可能会剩下大于sqrt(x)的质数