import math
n = int(input())
l = 0
r = 8 * n
while l + 1 < r:
m = (l + r) // 2
if m * (m + 1) / 2 < n:
l = m
else:
r = m
print(2 * n - l - 1)
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
18196 KB |
Output is correct |
2 |
Correct |
36 ms |
18216 KB |
Output is correct |
3 |
Correct |
34 ms |
18216 KB |
Output is correct |
4 |
Correct |
35 ms |
18264 KB |
Output is correct |
5 |
Correct |
35 ms |
18208 KB |
Output is correct |
6 |
Correct |
42 ms |
18308 KB |
Output is correct |
7 |
Correct |
38 ms |
18252 KB |
Output is correct |
8 |
Correct |
35 ms |
18200 KB |
Output is correct |
9 |
Correct |
33 ms |
18224 KB |
Output is correct |
10 |
Correct |
35 ms |
18240 KB |
Output is correct |
11 |
Correct |
34 ms |
18212 KB |
Output is correct |
12 |
Correct |
45 ms |
18248 KB |
Output is correct |
13 |
Correct |
38 ms |
18216 KB |
Output is correct |
14 |
Incorrect |
37 ms |
18216 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |