Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main(){
- int T;
- cin>>T;
- while(T--){
- long long A , d1 = 0 , d2 = 0 , maxprof = 0;
- cin>>A;
- long long prof = 0;
- for(d1 = 0 ; ; d1++){
- prof -= (1ll << d1);
- prof += A;
- if(prof <= 0) break;
- if(prof > maxprof){
- maxprof = prof;
- d2 = d1;
- }
- }
- cout<<d1<<' '<<++d2<<endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment