Untitled
unknown
plain_text
a year ago
431 B
7
Indexable
Never
def solve(): n = int(input()) ans = n l = 2 r = n while l <= r: m = l + (r - l) // 2 if (m - 1) > (n * 2) // m: r = m - 1 else: ans = m l = m + 1 val = n - (ans) * (ans - 1) // 2 print(val + ans) def main(): tc = int(input()) for _ in range(tc): solve() if __name__ == "__main__": main()