_Rehan's blog

By _Rehan, history, 6 years ago, In English

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

Full text and comments »

  • Vote: I like it
  • -12
  • Vote: I do not like it