Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Lasha Bukhnikashvili
- #include<iostream>
- #include<stdio.h>
- #include<cstdlib>
- #include<math.h>
- #include<algorithm>
- #include<vector>
- #include<fstream>
- #include<string>
- #include<stack>
- #include <iomanip>
- #define pi 3.1415926535
- #define mod9 1000000009
- #define mod7 1000000007
- #define INF 1000000000
- #define starttime clock_t startTime = clock();
- #define endtime cout<< double(clock()-startTime)/(double)CLOCKS_PER_SEC<<"seconds."<<endl;
- using namespace std;
- long long ans,i,mid,l,r,n,m,t[100001];
- int main(){
- //freopen("input.txt","r",stdin);
- //freopen("output.txt","w",stdout);
- cin>>n>>m;
- for (i=1;i<=n;i++)
- cin>>t[i];
- l=1; r=1000000000; r=r*r;
- while (l<r){
- ans=0;
- mid=(l+r)/2;
- for (i=1;i<=n;i++)
- ans=ans+mid/t[i];
- if (ans<m) l=mid+1; else r=mid;
- };
- cout<<l;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement