327B - Hungry Sequence - CodeForces Solution


math *1200

Please click on ads to support us..

Python Code:

n = int(input())
for x in range(n) : print(n+x,end = ' ')

C++ Code:

// Bismillahir Rahmanir Rahim
// SHAHRIAR MAHMUD ARMAN
// AUTHOR : iamarman252575
#include<bits/stdc++.h>
#include<ctime>
#include<string>
# define ll long long
# define test int test; cin>>test; while(test--)
# define rep(i,a,b) for(int i=a;i<b;i++)
#define rep_n(i,a,b) for(int i=a;i<=b;i++)
#define rep_rev(i,a,b) for(int i=b;a>=1;i--)
#define pb push_back
#define el endl
#define optimise()  { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin.clear(); }
#define R0 return 0
#define sz(x) x.size()
#define all(v) v.begin(),v.end()
#define srt(vvv) sort(vvv.begin(),vvv.end())
#define sp " "
#define vii vector<int>
#define vll vector<long long>
#define yess cout<<"YES"<<el
#define noo cout<<"NO"<<el
#define PI 2*acos(0.0)
using namespace std;
inline void file() {

#ifndef ONLINE_JUDGE

freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);

#endif // ONLINE_JUDGE
}

clock_t startTime;
double getCurrentTime() {
	return (double)(clock() - startTime) / CLOCKS_PER_SEC;
}

set<ll> se;
vector<ll> ve;
vector<bool> vec(10000000,1);
void seive()
{
    ll n=10000000;
    vec[0]=0;
    vec[1]=0;
    for(ll i=2;i*i<=n;i++)
    {
        if(vec[i]==1)
        {   
            for(ll j=i*i;j<=n;j=j+i)
            {
                vec[j]=0;
            }
        }
    }
for(int i=2;i<=n;i++)
if(vec[i]) ve.pb(i);
}
void solve()
{ 
    int n;
    cin>>n;
    for(int i=0;i<n;i++)
    {
      cout<<ve[i]<<el;
    }
} 
int main()

{
    optimise();
    seive();
    file();
    solve();





}


Comments

Submit
0 Comments
More Questions

71A - Way Too Long Words
160A - Twins
1A - Theatre Square
1614B - Divan and a New Project
791A - Bear and Big Brother
1452A - Robot Program
344A - Magnets
96A - Football
702B - Powers of Two
1036A - Function Height
443A - Anton and Letters
1478B - Nezzar and Lucky Number
228A - Is your horseshoe on the other hoof
122A - Lucky Division
1611C - Polycarp Recovers the Permutation
432A - Choosing Teams
758A - Holiday Of Equality
1650C - Weight of the System of Nested Segments
1097A - Gennady and a Card Game
248A - Cupboards
1641A - Great Sequence
1537A - Arithmetic Array
1370A - Maximum GCD
149A - Business trip
34A - Reconnaissance 2
59A - Word
462B - Appleman and Card Game
1560C - Infinity Table
1605C - Dominant Character
1399A - Remove Smallest