Advertisement
gihanchanaka

Untitled

Aug 16th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.17 KB | None | 0 0
  1. long x=(n+1)/2;
  2. long ans=0l;
  3.  
  4. ans=4*( ( (x*(2*x-1)*(2*x+1)) /3) -1 );
  5. ans-= 6*(Math.pow(x, 2)-1);
  6. ans+=3*(n-1);
  7. //return ans+2;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement