一直找不出问题,后来debug发现素数写错了
bool check(int x) { if(x<2) return 0; for(int i=2;i*i<=n/*就是这里!*/;i++) if(x%i==0) return 0; return 1; }