|
|
back to boardWhy WA Posted by newex 29 Nov 2010 10:15 #include<stdio.h> int main() { int v[15000]; v[0]=2; int j,i=3,l=0; int f; while(l<15000) { f=1; for(j=0;j<=l;j++) if(i%v[j]==0) { f=0; break; } if(f) { l+=1; v[l]=i; } i+=1; } int n,tmp; scanf("%d",&n); for(i=0;i<n;i++) { scanf("%d",&tmp); printf("%d\n",v[tmp-1]); } return 0; } |
|
|