n = int(input())
l = int(1)
r = int(10)
for i in range(100):
r = r*10
ans = int(1)
while l<=r:
mid = (l+r)
mid = mid//2
u = mid*(mid+1)
u = u//2
if(n<=u):
ans = mid
r = mid-1
else:
l = mid+1
lo = (ans-1)*(ans-1)+1
u = (ans-1)*(ans)
u = u//2
#print(u)
dif = n-(u+1)
#print(dif)
print(lo+dif*2)
#print(ans)
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
24 ms |
3300 KB |
Output is correct |
2 |
Correct |
25 ms |
3432 KB |
Output is correct |
3 |
Correct |
24 ms |
3488 KB |
Output is correct |
4 |
Correct |
25 ms |
3640 KB |
Output is correct |
5 |
Correct |
24 ms |
3692 KB |
Output is correct |
6 |
Correct |
24 ms |
3728 KB |
Output is correct |
7 |
Correct |
24 ms |
3736 KB |
Output is correct |
8 |
Correct |
23 ms |
3740 KB |
Output is correct |
9 |
Correct |
24 ms |
3744 KB |
Output is correct |
10 |
Correct |
24 ms |
3748 KB |
Output is correct |
11 |
Correct |
24 ms |
3752 KB |
Output is correct |
12 |
Correct |
24 ms |
3756 KB |
Output is correct |
13 |
Correct |
26 ms |
3760 KB |
Output is correct |
14 |
Correct |
26 ms |
3768 KB |
Output is correct |
15 |
Correct |
23 ms |
3768 KB |
Output is correct |
16 |
Correct |
24 ms |
3816 KB |
Output is correct |
17 |
Correct |
24 ms |
3816 KB |
Output is correct |
18 |
Correct |
24 ms |
3816 KB |
Output is correct |
19 |
Correct |
25 ms |
3816 KB |
Output is correct |
20 |
Correct |
23 ms |
3816 KB |
Output is correct |
21 |
Correct |
25 ms |
3816 KB |
Output is correct |
22 |
Correct |
24 ms |
3816 KB |
Output is correct |