목록문제 (388)
sm 기술 블로그
import sys input = sys.stdin.readline N = int(input()) paper = [[0]*101 for _ in range(101)] for _ in range(N): x,y = map(int, input().split()) for a in range(10): for b in range(10): paper[x+a][y+b] = 1 sum = 0 for i in paper : sum += i.count(1) print(sum) 간단히 0으로 종이 전체를 그리고, 10*10만큼 1로 바꾸고 겹치는 부분은 덮어 버린다. 전체의 종이에서 1의 개수를 세어준다.
import sys input = sys.stdin.readline score = {"A+":4.5,"A0":4.0,"B+":3.5,"B0":3.0,"C+":2.5,"C0":2.0,"D+":1.5,"D0":1.0,"F":0.0,"P":-1} subject = [list(input().split()) for i in range(20)] sum = 0.0 totalHakJum = 0.0 for i in range(20): if score[subject[i][2]] == -1: continue else: totalHakJum += float(subject[i][1]) sum += (float(subject[i][1]) * score[subject[i][2]]) print(format(sum / totalHak..
import sys input = sys.stdin.readline N = int(input()) star = (N*2)-1 N = star//2 + 1 starStack = list() for i in range(1, N+1): if i < N: blank = star-(i*2-1) tmp = ((blank//2) * " ") + ((star-blank) * "*") print(tmp) starStack.append(tmp) else: print(star * "*") for j in range(len(starStack)): print(starStack.pop()) 별찍기 - 스택 이용
SELECT ANIMAL_ID, NAME from( SELECT ins.ANIMAL_ID, ins.NAME,(outs.DATETIME - ins.DATETIME) as time FROM ANIMAL_INS as ins left join ANIMAL_OUTS as outs on ins.ANIMAL_ID = outs.ANIMAL_ID order by time desc limit 2 ) a 혹은 SELECT ins.ANIMAL_ID, ins.NAME FROM ANIMAL_INS as ins left join ANIMAL_OUTS as outs on ins.ANIMAL_ID = outs.ANIMAL_ID order by (outs.DATETIME - ins.DATETIME) desc limit 2 문제 : 보호..