Skip to main content

Practice · 5 of 5

Ladders Over the Sum

CHALLENGE
Difficulty: advanced+25 XP

**Bài toán.** For each of T queries S, print the minimal x with 1 + 2 + … + x ≥ S. **Constraints:** 1 ≤ T ≤ 10^4; 1 ≤ S ≤ 10^18. Binary search the answer; m ≤ 2·10^9 keeps m(m+1) inside long long.

Back to lesson: Practice: Attack Pattern Drills