ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1040. Airline Company

HOW COME?
Posted by Dmitry "Logam" Kobelev 3 Jan 2008 22:31
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?
Posted by elmariachi1414 (TNU) 14 Jan 2008 15:18
Because numbers must be [1..M]