Advertisement
astral17

1_2

Mar 27th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.60 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #include "neutrino.h"
  3.  
  4. using namespace std;
  5.  
  6. vector<int> v = {2, 3, 5, 7, 11, 13, 17, 19, 23};
  7.  
  8. bool isprime(long long x)
  9. {
  10.     long long sqrtx = trunc(sqrt(x));
  11.     for (int i = 2; i <= sqrtx; i++)
  12.         if (x % i == 0)
  13.             return false;
  14.     return true;
  15. }
  16.  
  17. int main()
  18. {
  19.     vector<bool> prime(100005, true);
  20.     prime[0] = prime[1] = false;
  21.     for (int i = 2; i < 100005; i++)
  22.         if (prime[i] && i * 1ll * i < 100005)
  23.             for (int j = i * i; j < 100005; j += i)
  24.                 prime[j] = false;
  25.     vector<int> primes, divs;
  26.     queue<int> q;
  27.     for (int i = 2; i < prime.size(); i++)
  28.         if (prime[i])
  29.             primes.push_back(i);
  30.     long long x = 1, y = 0, res, ans = 1;
  31.     int n = Init();
  32.     for (int i = 0; i < primes.size() && primes[i] <= n; i++)
  33.     {
  34.         if (x * primes[i] > 1e9)
  35.         {
  36.             res = NeutrinoFlow(x, 0);
  37.             x = 1;
  38.             while (!q.empty())
  39.             {
  40.                 if (res % q.front() == 0)
  41.                     divs.push_back(q.front());
  42.                 q.pop();
  43.             }
  44.         }
  45.         x *= primes[i];
  46.         q.push(primes[i]);
  47.     }
  48.     if (x > 1)
  49.     {
  50.         res = NeutrinoFlow(x, 0);
  51.         while (!q.empty())
  52.         {
  53.             if (res % q.front() == 0)
  54.                 divs.push_back(q.front());
  55.             q.pop();
  56.         }
  57.     }
  58.     for (int i = 0; i < divs.size(); i++)
  59.     {
  60.         x = 1;
  61.         while (x * divs[i] <= 1e9)
  62.             x *= divs[i];
  63.         ans *= NeutrinoFlow(x, 0);
  64.     }
  65.     Locate(ans);
  66.     return 0;
  67. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement