1578E - Easy Scheduling--this is the problem
here is my code. basically wont the total time be-- for i =0 to h-1 summation of ceil(2^i/p) is this observation wrong? For some reason the link is'nt working , so here is the code-
#include <bits/stdc++.h>
#define ll long long int
#define endl "\n"
using namespace std;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t;
cin>>t;
while(t--){
double h,p;
cin>>h>>p;
ll pow=1;
ll time=0;
for(int i=0;i<h;i++){
time+=ceil(pow/p);
pow*=2;
}
cout<<time<<endl;
}
return 0;
}