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 |
12 ms |
2896 KB |
Output is correct |
2 |
Correct |
14 ms |
2896 KB |
Output is correct |
3 |
Correct |
13 ms |
3152 KB |
Output is correct |
4 |
Correct |
12 ms |
2896 KB |
Output is correct |
5 |
Correct |
12 ms |
2896 KB |
Output is correct |
6 |
Correct |
12 ms |
2948 KB |
Output is correct |
7 |
Correct |
13 ms |
2924 KB |
Output is correct |
8 |
Correct |
12 ms |
2896 KB |
Output is correct |
9 |
Correct |
12 ms |
2896 KB |
Output is correct |
10 |
Correct |
13 ms |
2956 KB |
Output is correct |
11 |
Correct |
12 ms |
2888 KB |
Output is correct |
12 |
Correct |
13 ms |
2896 KB |
Output is correct |
13 |
Correct |
12 ms |
2912 KB |
Output is correct |
14 |
Incorrect |
14 ms |
2896 KB |
Output isn't correct |
15 |
Halted |
0 ms |
0 KB |
- |