제출 #382939

#제출 시각아이디문제언어결과실행 시간메모리
382939AlexandraAkcija (COCI15_akcija)Cpython 3
80 / 80
282 ms7320 KiB
n = int(input()) books = [] resp = 0 for i in range (n): books.append(int(input())) books.sort(reverse=True) mod = n%3 if mod==0: groups = n//3 else: groups = n//3 + 1 cont = 1 for i in range (0, n, 3): resp += books[i] if cont == groups: if mod==2 or mod == 0: resp += books[i+1] else: resp += books[i+1] cont += 1 print (str(resp))
#Verdict Execution timeMemoryGrader output
Fetching results...