You are viewing a single comment's thread. Return to all comments →
it's pretty simple code with complexity of O(1) without any loop
int main(){ long long int t,a,b; cin >> t; a=ceil(log2 (1.0*(t+3)/3)); b=3*(pow(2,a)-1); a=b-t+1; cout<<a; return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Strange Counter
You are viewing a single comment's thread. Return to all comments →
it's pretty simple code with complexity of O(1) without any loop