Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<bits/stdc++.h>
- using namespace std;
- #define nl "\n"
- #define fi first
- #define se second
- #define pb push_back
- #define ll long long
- #define ull unsigned ll
- #define RV return void
- #define sz(x) int(x.size())
- #define all(v) v.begin(), v.end()
- #define rall(v) v.rbegin(), v.rend()
- #define fixed(n) fixed << setprecision(n)
- #define cin(v) for (auto&i:v) cin >> i;
- #define cout(v) for (auto&i:v) cout << i << " ";
- #define clr(memo, x) memset(memo, x, sizeof memo)
- #define FastCode ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr);
- void Zainab(){
- // #ifndef ONLINE_JUDGE
- freopen("longpath.in", "r", stdin);
- freopen("longpath.out", "w", stdout);
- // #endif
- }
- const ll N = 1e7;
- vector < bool > isPrime (N + 1 , true);
- vector < ll > primes ;
- void pre(){
- isPrime[0]= isPrime[1]=false;
- for(ll i = 2 ; i * i <= N ; i++)
- if(isPrime[i])
- for(ll j = i * i ; j <= N ; j +=i )
- isPrime[j] = false;
- for(ll i =0 ; i < N+1 ; ++i )
- if(isPrime[i]) primes.pb(i);
- }
- void myCode(){
- ll n;
- cin >> n ;
- // ll sum =0;
- // __int128 fact =1;
- // for(ll i =1 ; i <= 100 ; i++) {
- // // long double temp = cos( (fact + 1 )/i *3.1415926 );
- // // cout << i << " " << temp * temp << nl;
- // if( (fact + 1 ) % i==0){
- // sum ++;
- // cout << i << " " << sum << nl;
- // }
- // fact *=i;
- // }
- // cout << sum << nl << nl;
- long double mo = 1 , lg = ceil(log2(n));
- ll l =0 ,r = sz(primes) -1 ;
- while(l <= r ){
- ll mid = r - (r-l)/2;
- if(primes[mid] <= n) {
- l = mid+1;
- mo = mid + 2;
- }
- else
- r = mid-1;
- }
- // cout << mo << " ";
- cout << fixed(6) << pow( lg / mo , 1/lg) << nl;
- }
- int main(){
- FastCode ;
- // Zainab() ;
- int testCase=1;
- cin >> testCase ;
- pre();
- for(int i=1 ; i<= testCase ; i++)
- myCode();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement