Codeforces Round #701 (Div. 2) problem C. Floor and Mod

Revision en3, by _Rehan, 2021-02-13 12:28:06

Problem link solution link Its giving me tle but I think the approach is correct. Can anyone help me to improve the complexity of my solution. Thanks in advance.

try: t=int(input()) for _ in range(t): a,b=map(int,input().split()) res=0 while a//b < b: if (a%b) >= (a//b): res+=(a//b) else: res+=(a//b-1) b-=1 print(res+ ( (b-1)*b ) //2 ) except EOFError: pass

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en3 English _Rehan 2021-02-13 12:28:06 58
en2 English _Rehan 2021-02-13 12:26:16 120
en1 English _Rehan 2021-02-13 12:24:52 573 Initial revision (published)