fork(20) download
  1. #include<iostream>
  2. #include<stdio.h>
  3. #include<bitset>
  4. #include<vector>
  5. #include<math.h>
  6. #define N 10000000
  7. using namespace std;
  8. bitset <N> bits ;
  9. int primes[N] ;
  10. void precomputation(){
  11. for(int i = 2; i < N; i += 2) primes[i] = 2 ;
  12. int sq=sqrt(N-1);
  13. for(int i = 3; i < N; i += 2)
  14. if (!bits[i]){
  15. primes[i] = i ;
  16. if(i<=sq) for(int j = i * i; j < N; j += 2 * i)
  17. if (!bits[j]){
  18. primes[j] = i ;
  19. bits[j] = 1 ;
  20.  
  21. }
  22. }
  23. cout << "success" << endl ;
  24. }
  25.  
  26. /*long long int exponent (int base, int exp){
  27.   long long int res;
  28.   if (exp == 0)
  29.   return 1;
  30.   res = exponent(base, exp/2) ;
  31.   if (exp%2 == 0)
  32.   return (res * res);
  33.   return (base * res * res) ;
  34. }
  35.  
  36.  
  37. long long int factor (long long int n) {
  38.   long long res = 1 ;
  39.   int count;
  40.   while(n > 1){
  41.   count = 0 ;
  42.   int i = primes[n] ;
  43.   while(n % i == 0){
  44.   n /= i ;
  45.   count++ ;
  46.   }
  47.   res *= (exponent(i, count+1) - 1) / (i - 1) ;
  48.   cout << endl ;
  49.   }
  50.   return res ;
  51. }*/
  52. int main(){
  53.  
  54. ios_base::sync_with_stdio(false) ; cin.tie(0) ;
  55. precomputation() ;
  56. cout << "success" << endl ;
  57.  
  58.  
  59. /*int t;
  60.   long long int n ;
  61.   cin >> t ;
  62.   while(t--){
  63.   cin >> n ;
  64.   //cout << factor(n) - n << "\n";
  65.   }*/
  66. return 0 ;
  67. }
  68.  
Success #stdin #stdout 0.19s 43144KB
stdin
1
100
stdout
success
success