#include<bits/stdc++.h> #include<iostream> #include<cmath> #include<cstring> #include<algorithm> #include<cstdio> #include<stdlib.h> #include<time.h> #pragmawarning(disable:4996) #define times 20 usingnamespace std; #define ll long long map<ll, ll> mp;
ll total; ll factor[110];
ll qmul(ll a, ll b, ll M){ a %= M; b %= M; ll ans = 0; while (b) { if (b & 1) { ans = (ans + a) % M; } a = (a <<= 1) % M; b >>= 1; } return ans % M; }///快乘,因为两个longlong的数相乘可能会溢出,所以这里转乘法为加法,思想和快速幂相似 ll qpow(ll a, ll b, ll int M){ ll ans = 1; ll k = a; while (b) { if (b & 1)ans = qmul(ans, k, M) % M; k = qmul(k, k, M) % M; b >>= 1; } return ans % M; }
boolwitness(ll a, ll n, ll x, ll sum){ ll judge = qpow(a, x, n); if (judge == n - 1 || judge == 1)return1; while (sum--) { judge = qmul(judge, judge, n); if (judge == n - 1)return1; } return0; }
boolmiller(ll n){ ///判断素数 if (n < 2)return0; if (n == 2)return1; if ((n & 1) == 0)return0; ll x = n - 1; ll sum = 0; while (x % 2 == 0) { x >>= 1; sum++; } for (ll i = 1; i <= times; i++) { ll a = rand() % (n - 1) + 1; if (!witness(a, n, x, sum))return0; ///费马小定理的随机数检验 } return1; }
ll gcd(ll a, ll b){ return b == 0 ? a : gcd(b, a % b); }
ll pollard(ll n, ll c){ ll x, y, d, i = 1, k = 2; x = rand() % n; y = x; while (1) { i++; x = (qmul(x, x, n) + c) % n; ///不断调整x d = gcd(y - x, n); if (d < 0)d = -d; if (d > 1 && d < n)return d; ///找到因子 if (y == x)return n; ///找到循环,返回n,重新来 if (i == k) { ///一个优化 y = x; k <<= 1; } } }
voidfind(ll n){ if (miller(n)) { factor[++total] = n; mp[n]++; return; } ll p = n; while (p >= n) p = pollard(p, rand() % (n - 1) + 1); find(n / p); find(p); }
intmain(){ int t; scanf("%d", &t); while (t--) { total = 0; ll n; scanf("%lld", &n); if (n == 1) { puts("no"); continue; } mp.clear(); find(n); int flag = 0; for (auto& tem : mp) { if (tem.second >= 2) { flag = 1; break; } } printf("%s\n", (flag == 1 ? "yes" : "no")); } }
voidini(){ for (int i = 2; i <= maxn; ++i) { int s = sqrt(i); bool ok = true; for (int j = 2; j <= s; ++j) { if (i % j == 0) { ok = false; break; } } if (ok) { prime.push_back(i); } }
for (auto x : prime) { for (ll i = x; i <= maxn; i = i * x) { ll c = i; double w = log(i); item[x].push_back(make_pair(c, w)); } }
int n = prime.size();
for (int k = 0; k < n; ++k) { for (int v = maxn; v >= 0; --v) { for (int i = 0; i < item[prime[k]].size(); ++i) { ll c = item[prime[k]][i].first; double w = item[prime[k]][i].second; if (v >= c) { f[v] = max(f[v], f[v - c] + w); } } } } }
intmain(){ // // for (int i = 1; i <= 100; i++) { // int ans = dfs(0, i ); // cout << log(ans) << "\n"; // }
ini(); int t; scanf("%d", &t); for (int i = 1; i <= t; ++i) { int b; scanf("%d", &b); printf("%.10lf\n", f[b]); // printf("%.10lf\n",pow(2.718281828, f[b])); // printf("%.10lf\n", log(dfs(0, b))); // cout << dfs(0, b) << "\n"; // showfactor(dfs(0, b)); // showfactor(1021020); } }