|
|
back to boardHOW COME? Why cant we just output first M prime numbers??? WA1 #include<stdio.h> #include<math.h> void main() {int n,h; bool f; scanf("%i%i",&n,&n); printf("YES\n1"); for(int i=2,j=1;j<n;i++) {h=(int)sqrt((float)i); f=0; for(int k=2;k<=h;k++) if((i%k)==0) {f=1;break;} if(!f){printf(" %i",i);j++;} } } Re: HOW COME? Because numbers must be [1..M] |
|
|