답안 #337970

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
337970 2020-12-22T08:14:37 Z amunduzbaev 홀-짝 수열 (IZhO11_oddeven) Python 3
0 / 100
2000 ms 2796 KB
n = int(input())
sz = 1
last = 1
prev = 0
i = 2
while (sz < n):
    prev = last
    last += (i*2)-1
    sz += i
    i+=1
if(sz == n):
    print(last % 10)
else :
    while(sz > n and prev < last):
        last -= 2
        sz -= 1
    print(last)
# 결과 실행 시간 메모리 Grader output
1 Correct 16 ms 2796 KB Output is correct
2 Correct 16 ms 2796 KB Output is correct
3 Correct 16 ms 2796 KB Output is correct
4 Correct 19 ms 2796 KB Output is correct
5 Correct 20 ms 2796 KB Output is correct
6 Correct 35 ms 2796 KB Output is correct
7 Execution timed out 2033 ms 2796 KB Time limit exceeded
8 Halted 0 ms 0 KB -