Submission #523242

# Submission time Handle Problem Language Result Execution time Memory
523242 2022-02-07T09:11:43 Z redstonegamer22 Odd-even (IZhO11_oddeven) C++17
Compilation error
0 ms 0 KB
import math

def solve(n):
    n = int(n)

    m = math.isqrt(2 * n) - 5

    while m <= -1 or (m + 1) * (m + 2) // 2 < n:
        m = m + 1


    a = m * (m + 1) // 2 + m * (m - 1) // 2
    b = n - m * (m + 1) // 2


    ans = a + 2 * b - 1

    return ans

print(solve(input()))

Compilation message

oddeven.cpp:1:1: error: 'import' does not name a type
    1 | import math
      | ^~~~~~