n=int(input())
l=1; r=10**51; best=100
while l<=r:
mid=(l+r)//2
if mid*(mid+1)//2>=n:
best=mid
r=mid-1
else:
l=mid+1
print(2*n-best)
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
19260 KB |
Output is correct |
2 |
Correct |
20 ms |
19260 KB |
Output is correct |
3 |
Correct |
20 ms |
19260 KB |
Output is correct |
4 |
Correct |
20 ms |
19424 KB |
Output is correct |
5 |
Correct |
24 ms |
19256 KB |
Output is correct |
6 |
Correct |
20 ms |
19260 KB |
Output is correct |
7 |
Correct |
22 ms |
19260 KB |
Output is correct |
8 |
Correct |
21 ms |
19332 KB |
Output is correct |
9 |
Correct |
20 ms |
19260 KB |
Output is correct |
10 |
Correct |
20 ms |
19260 KB |
Output is correct |
11 |
Correct |
19 ms |
19344 KB |
Output is correct |
12 |
Correct |
22 ms |
19420 KB |
Output is correct |
13 |
Correct |
21 ms |
19260 KB |
Output is correct |
14 |
Correct |
20 ms |
19260 KB |
Output is correct |
15 |
Correct |
22 ms |
19252 KB |
Output is correct |
16 |
Correct |
23 ms |
19712 KB |
Output is correct |
17 |
Correct |
21 ms |
19260 KB |
Output is correct |
18 |
Correct |
21 ms |
19432 KB |
Output is correct |
19 |
Correct |
25 ms |
19260 KB |
Output is correct |
20 |
Correct |
20 ms |
19260 KB |
Output is correct |
21 |
Correct |
20 ms |
19260 KB |
Output is correct |
22 |
Correct |
20 ms |
19324 KB |
Output is correct |