Advertisement
DimaT1

lomonosov_2016_z_6

Sep 2nd, 2016
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <iostream>
  2. #include <vector>
  3. #include <string>
  4.  
  5. const int N = 1000000;
  6.  
  7. using namespace std;
  8.  
  9. int main() {
  10.     vector<char> a(N, true);
  11.  
  12.     a[0] = a[1] = false;
  13.     for(long long i = 2; i < N; i++)
  14.         if(a[i])
  15.             if(i * i < N)
  16.                 for(long long j = i * i; j < N; j+= i)
  17.                     a[j] = false;
  18.  
  19.  
  20.     string s = "01";
  21.     for(long long i = 2; i < N; i++)
  22.         if(!a[i])
  23.             s+= to_string(i);
  24.  
  25.     for(int i = 2012; i < 2022; i++)
  26.         cout << s.at(i);
  27.     cout << endl;
  28.     //38 44 84 58 46
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement