我擦,为什么我的AC不了,杨大哥,求指点
程序代码:
#include <stdio.h> #include <math.h> int prime[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149}; int isprime(int n) { int i, j; if(n < 2) return 0; if (n == 2) return n; j = (int)sqrt((float)n); for(i = 0; prime[i]<=j; i++) if(n%prime[i] == 0) return 0; return n; } int main() { int Max=0, N, i=0, j, s, tmp, t=1, B, r, x; scanf("%d",&N); for (t=0; t<N; t++) { scanf("%d", &B); t==0?r=B:1; j = (int)sqrt((float)B); for (i=2; i<=j; i++) { if (B%i==0) { s = isprime(B/i); x = isprime(i); tmp = (x>s?x:s); if (tmp>Max) Max = tmp, r=B; } } } printf("%d\n",r); return 0; }