SagarPrasad's blog

By SagarPrasad, history, 6 weeks ago, In English
void solve(){
    long long int n;
    long long int sol=0;
    for(int i=0;i<63;i++){

Here for the test case 1 765228007342234864

solution is not coming correct and I need to typecast my pow(2,i) to (long long int)pow(2,i). For i=0, n/pow(2,i) is not even equal to n, why is it so?

As far as i know pow function gives value in double but even so the value of double should be 1.0 and hence n/(1.0) should be n, instead i am getting 765228007342234880 for the above test case which is more then n. 1362C - Johnny and Another Rating Drop Any help is appreciated. Thank You

Tags pow, c++
  • Vote: I like it
  • -16
  • Vote: I do not like it