import math
n = int(input())
l = 0
r = 8 * n
while l + 1 < r:
m = (l + r) // 2
if m * m <= 8 * n - 7:
l = m
else:
r = m
# print(l, math.sqrt(8 * n - 7))
print(2 * n - math.floor((1 + l) / 2))
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
18220 KB |
Output is correct |
2 |
Correct |
35 ms |
18152 KB |
Output is correct |
3 |
Correct |
38 ms |
18216 KB |
Output is correct |
4 |
Correct |
37 ms |
18216 KB |
Output is correct |
5 |
Correct |
35 ms |
18224 KB |
Output is correct |
6 |
Correct |
38 ms |
18216 KB |
Output is correct |
7 |
Correct |
38 ms |
18240 KB |
Output is correct |
8 |
Correct |
35 ms |
18212 KB |
Output is correct |
9 |
Correct |
36 ms |
18224 KB |
Output is correct |
10 |
Correct |
35 ms |
18212 KB |
Output is correct |
11 |
Correct |
36 ms |
18220 KB |
Output is correct |
12 |
Correct |
35 ms |
18220 KB |
Output is correct |
13 |
Correct |
41 ms |
18224 KB |
Output is correct |
14 |
Incorrect |
36 ms |
18360 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |