Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Bismillahir Rahmanir Rahim
- //============================
- #include<bits/stdc++.h>
- using namespace std;
- #define ll long long
- #define endl "\n"
- #define infL LLONG_MAX
- #define infI INT_MAX
- #define pb push_back
- #define fo(i,a,b) for(int i=a;i<b;i++)
- #define precise(x,y)cout<<fixed<<setprecision(y)<<x<<endl;
- #define MAX 20000000000
- #define yes cout<<"YES"<<endl
- #define no cout<<"NO"<<endl
- #define bye return 0
- #define PEREGRINE_FALCON {ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);}
- ll mod=1e9+7;
- ll Pi =acos(-1);
- double epsilon = 0.0000001f;
- ll lowerBinSrch(ll n, double sum)
- {
- ll lo=1;
- ll hi=MAX;
- ll md,temp=2;
- double k;
- while(lo<=hi){
- md=lo+((hi-lo)/2);
- k=n*(log10(md));
- if(k>sum){
- temp=md;
- hi=md-1;
- }
- else{lo=md+1;}
- }
- return temp;
- }
- int main()
- {
- PEREGRINE_FALCON
- //freopen("inputNew.txt", "r", stdin);
- ll testCase=1;
- //cin>>testCase;
- while(testCase--){
- double m,k,x,y,z,a,b,c,d,mn,mx,temp,cnt,ans,sum,sz,len;
- ll n;
- cin>>n;
- double arr[n];
- sum=0;
- for(int i=0; i<n; i++){
- cin>>arr[i];
- sum+=log10(arr[i]);
- }
- //cout<<"sum: "<<sum<<endl;
- cout<<(lowerBinSrch(n,sum))<<endl;
- }
- bye;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement