Title Description
Description
Iahub and Iahubina went to a fancy restaurant to date, but when the bill was paid, the cashier did not charge them for the meal, but asked them to write a series. The requirements for this sequence are as follows:
1, the length of the sequence is n
2, for any of the two of the sequence to meet the i<j of the number of AI, AJ, the requirements of Ai<aj.
3, for any of the two of the sequence of i<j to meet the number of AI, AJ, the AI can not be divisible into AJ.
Enter a description
Input Description
A number n
Output description
Output Description
A row, n number, the series.
If there are many feasible series, the output dictionary is the smallest one.
Sample input
Sample Input
3
Sample output
Sample Output
2 3 5
Data range and Tips
Data Size & Hint
0<n<=105
Code:
/*Sieve Method*/#include<cstdio>using namespacestd;intN,tot;BOOLa[1300001];voidShai () { for(Long LongI=2; i<=1300000; i++) if(a[i]==0) for(Long Longj=2*i;j<=1300000; j+=i) a[j]=1;}intMain () {scanf ("%d",&N); if(n==1) {printf ("1"); return 0; } Long LongI=2; Shai (); while(tot<N) {if(a[i]==0) printf ("%lld", i), tot++; I++; } return 0;}
Codevs 2947 Hunger Series