Sanath12345

Untitled

May 9th, 2021
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. //Problem link :
  2. //done by sanath kumar
  3. #include<bits/stdc++.h>
  4. using namespace std;
  5. #define ll long long int
  6. #define ld long double
  7. #define mod 1000000007
  8. #define inf 1e9
  9. #define endl "\n"
  10. #define pb push_back
  11. #define vi vector<ll>
  12. #define vs vector<string>
  13. #define pii pair<ll,ll>
  14. #define ump unordered_map
  15. #define mp make_pair
  16. #define pq_max priority_queue<ll>
  17. #define pq_min priority_queue<ll,vector<ll>,greater<ll>>
  18. #define all(v) v.begin(),v.end()
  19. #define ff first
  20. #define ss second
  21. #define mid(l,r) (l+(r-l))/2
  22. #define bitc(x) __builtin_popcount(x)
  23. #define loop(i,a,b) for(int i=(a);i<=(b);i++)
  24. #define looprev(i,a,b) for(int i=(a);i>=(b);i--)
  25. #define iter(c,it) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
  26. #define log(args...) {string _s=#args;replace(_s.begin(),_s.end(),',',' ');stringstream _ss(_s);istream_iterator<string> _it(_ss);err(_it,args);}
  27. #define logarr(arr,a,b) for(int z=(a);z<=(b);z++) cout<<(arr[z])<<" ";cout<<endl;
  28. template<typename T> T gcd(T a,T b) {if(b==0) return a; return gcd(b,a%b);}
  29. template<typename T> T lcm(T a,T b) {return a*(b/gcd(a,b));}
  30.  
  31. void err(istream_iterator<string> it){}
  32. template<typename T,typename... Args>
  33. void err(istream_iterator<string> it,T a,Args... args){
  34. cout<<*it<<" = "<<a<<endl;
  35. err(++it,args...);
  36. }
  37.  
  38. void file_i_o(){
  39. ios_base::sync_with_stdio(false);
  40.  
  41. cin.tie(0);
  42. cout.tie(0);
  43. #ifndef ONLINE_JUDGE
  44. freopen("input.txt","r",stdin);
  45. freopen("output.txt","w",stdout);
  46. #endif
  47. }
  48. vi primes;
  49. void getprime(){
  50. bool isprime[2000001];
  51. loop(i,0,200000) isprime[i]=true;
  52. isprime[0]=false;
  53. isprime[1]=false;
  54. loop(i,2,sqrt(200000)){
  55. int p=i;
  56. while(p*i<=200000){
  57. isprime[p*i]=false;
  58. p++;
  59. }
  60. }
  61. loop(i,1,200000){
  62. if(isprime[i]) primes.pb(i);
  63. }
  64. }
  65. int main(){
  66. file_i_o();
  67. clock_t begin=clock();
  68. int n;
  69. cin>>n;
  70. getprime();
  71. // log(primes.size());
  72. ll arr[n];
  73. arr[0]=10,arr[n-1]=6;
  74. ll val[1000];
  75. loop(i,0,999) val[i]=0;
  76. val[2]=1;
  77. val[1]=1;
  78. int k=1;
  79. cout<<arr[0]<<" ";
  80. loop(i,1,n-2){
  81. arr[i]=1;
  82. loop(j,1,900){
  83. arr[i]*=pow(primes[j],val[j]);
  84. }
  85. if(val[k]==3){
  86. if(k==1 or k==2) val[k]=1;
  87. else val[k]=0;
  88. k++;
  89. }
  90. val[k]++;
  91. cout<<arr[i]<<" ";
  92. }
  93. cout<<arr[n-1]<<endl;
  94. #ifndef ONLINE_JUDGE
  95. clock_t end=clock();
  96. cout<<"\n\n\nExecuted in :"<<double(end-begin)/CLOCKS_PER_SEC*1000<<" ms"<<endl;
  97. #endif
  98. }
Advertisement
Add Comment
Please, Sign In to add comment