Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Problem link :
- //done by sanath kumar
- #include<bits/stdc++.h>
- using namespace std;
- #define ll long long int
- #define ld long double
- #define mod 1000000007
- #define inf 1e9
- #define endl "\n"
- #define pb push_back
- #define vi vector<ll>
- #define vs vector<string>
- #define pii pair<ll,ll>
- #define ump unordered_map
- #define mp make_pair
- #define pq_max priority_queue<ll>
- #define pq_min priority_queue<ll,vector<ll>,greater<ll>>
- #define all(v) v.begin(),v.end()
- #define ff first
- #define ss second
- #define mid(l,r) (l+(r-l))/2
- #define bitc(x) __builtin_popcount(x)
- #define loop(i,a,b) for(int i=(a);i<=(b);i++)
- #define looprev(i,a,b) for(int i=(a);i>=(b);i--)
- #define iter(c,it) for(__typeof(c.begin()) it=c.begin();it!=c.end();it++)
- #define log(args...) {string _s=#args;replace(_s.begin(),_s.end(),',',' ');stringstream _ss(_s);istream_iterator<string> _it(_ss);err(_it,args);}
- #define logarr(arr,a,b) for(int z=(a);z<=(b);z++) cout<<(arr[z])<<" ";cout<<endl;
- template<typename T> T gcd(T a,T b) {if(b==0) return a; return gcd(b,a%b);}
- template<typename T> T lcm(T a,T b) {return a*(b/gcd(a,b));}
- void err(istream_iterator<string> it){}
- template<typename T,typename... Args>
- void err(istream_iterator<string> it,T a,Args... args){
- cout<<*it<<" = "<<a<<endl;
- err(++it,args...);
- }
- void file_i_o(){
- ios_base::sync_with_stdio(false);
- cin.tie(0);
- cout.tie(0);
- #ifndef ONLINE_JUDGE
- freopen("input.txt","r",stdin);
- freopen("output.txt","w",stdout);
- #endif
- }
- vi primes;
- void getprime(){
- bool isprime[2000001];
- loop(i,0,200000) isprime[i]=true;
- isprime[0]=false;
- isprime[1]=false;
- loop(i,2,sqrt(200000)){
- int p=i;
- while(p*i<=200000){
- isprime[p*i]=false;
- p++;
- }
- }
- loop(i,1,200000){
- if(isprime[i]) primes.pb(i);
- }
- }
- int main(){
- file_i_o();
- clock_t begin=clock();
- int n;
- cin>>n;
- getprime();
- // log(primes.size());
- ll arr[n];
- arr[0]=10,arr[n-1]=6;
- ll val[1000];
- loop(i,0,999) val[i]=0;
- val[2]=1;
- val[1]=1;
- int k=1;
- cout<<arr[0]<<" ";
- loop(i,1,n-2){
- arr[i]=1;
- loop(j,1,900){
- arr[i]*=pow(primes[j],val[j]);
- }
- if(val[k]==3){
- if(k==1 or k==2) val[k]=1;
- else val[k]=0;
- k++;
- }
- val[k]++;
- cout<<arr[i]<<" ";
- }
- cout<<arr[n-1]<<endl;
- #ifndef ONLINE_JUDGE
- clock_t end=clock();
- cout<<"\n\n\nExecuted in :"<<double(end-begin)/CLOCKS_PER_SEC*1000<<" ms"<<endl;
- #endif
- }
Advertisement
Add Comment
Please, Sign In to add comment