Trace_X1729's blog

By Trace_X1729, history, 21 month(s) ago, In English

EDIT : My query has already been answered, thank you for the help.

  • Vote: I like it
  • +15
  • Vote: I do not like it

| Write comment?
»
21 month(s) ago, hide # |
Rev. 2  
Vote: I like it +6 Vote: I do not like it

Seems like int overflow in ans -=((x)*(x + 1))/2;

Check the following:

int x=(1<<20); ll ans=x*x; cout<<ans<<'\n';

it outputs 0 instead of $$$2^{40}$$$.

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Why havn't you delete this yet.