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)
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
22 ms |
19252 KB |
Output is correct |
2 |
Correct |
23 ms |
19260 KB |
Output is correct |
3 |
Correct |
22 ms |
19260 KB |
Output is correct |
4 |
Correct |
21 ms |
19260 KB |
Output is correct |
5 |
Correct |
22 ms |
19260 KB |
Output is correct |
6 |
Correct |
22 ms |
19260 KB |
Output is correct |
7 |
Correct |
23 ms |
19260 KB |
Output is correct |
8 |
Correct |
21 ms |
19320 KB |
Output is correct |
9 |
Correct |
22 ms |
19416 KB |
Output is correct |
10 |
Correct |
22 ms |
19260 KB |
Output is correct |
11 |
Correct |
21 ms |
19260 KB |
Output is correct |
12 |
Correct |
23 ms |
19260 KB |
Output is correct |
13 |
Correct |
22 ms |
19460 KB |
Output is correct |
14 |
Correct |
22 ms |
19260 KB |
Output is correct |
15 |
Correct |
21 ms |
19256 KB |
Output is correct |
16 |
Correct |
23 ms |
19260 KB |
Output is correct |
17 |
Correct |
21 ms |
19512 KB |
Output is correct |
18 |
Correct |
27 ms |
19432 KB |
Output is correct |
19 |
Correct |
24 ms |
19260 KB |
Output is correct |
20 |
Correct |
21 ms |
19260 KB |
Output is correct |
21 |
Correct |
22 ms |
19284 KB |
Output is correct |
22 |
Correct |
22 ms |
19440 KB |
Output is correct |