598A-Why is not working?

Revision en1, by henrique08061999, 2020-10-02 17:24:01

598A- python3 from math import log2 def sum_until_n(n): return n*(n+1)/2 def sum_of_squares(n): return 2**(int(log2(n))+1)-1

m=int(input()) res=[] for i in range(m): n=int(input()) k=int(sum_until_n(n)-(2*sum_of_squares(n))) res.append(k) for v in res: print(v)

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English henrique08061999 2020-10-02 17:24:01 328 Initial revision (published)