본문 바로가기

백준(BOJ) 풀이

(46)
[백준 1085] 직사각형에서 탈출 x,y,w,h=map(int, input().split()) print(min(x,y,w-x,h-y))
[백준 10828] 스택 import sys stack=[] n=int(sys.stdin.readline().rstrip()) for i in range(n): command=sys.stdin.readline().rstrip() if command[:2]=='pu': stack.append(int(command[5:])) if command[:2]=='to': if len(stack)==0: print(-1) else : print(stack[len(stack)-1]) if command[:2]=='si': print(len(stack)) if command[:2]=='po': if len(stack)==0: print(-1) else : print(stack.pop()) if command[:2]=='em': if len(st..
[백준 2775] 부녀회장이 될테야 N=int(input()) for _ in range(N): k=int(input()) n=int(input()) NofResident=[] NofResident.append([i+1 for i in range(n)]) for i in range(1,k+1): NofResident.append([sum(NofResident[i-1][:j+1]) for j in range(n)]) print(NofResident[k][n-1])
[백준 10250] 10250 ACM 호텔 n=int(input()) for i in range(n): h,w,c=map(int, input().split()) p=str(int((c-1)//h)+1) q=str((c-1)%h+1) if len(p)==1: p='0'+p print(q+p)
[백준 1316] 그룹 단어 체커 n=int(input()) ans=0 for i in range(n): s=input() k=0 chk=[0]*26 while len(s)-k: if chk[ord(s[k])-97]==1: chk[ord(s[k])-97]=2 break if chk[ord(s[k])-97]==0: chk[ord(s[k])-97]=1 while True: if k
[백준 2941] 크로아티아 알파벳 S=input().rstrip() k=0 c=0 n=len(S) while True: if k
[백준 5622] 다이얼 dic = {'a':2, 'b':2, 'c':2, 'd':3, 'e':3, 'f':3, 'g':4, 'h':4, 'i':4, 'j':5, 'k':5, 'l':5, 'm':6, 'n':6, 'o':6, 'p':7, 'q':7, 'r':7, 's':7, 't':8, 'u':8, 'v':8, 'w':9, 'x':9, 'y':9, 'z':9} Dail=input().rstrip().lower() ans=0 for i in Dail: ans+=dic[i]+1 print(ans)
[백준 2908] 상수 import sys a,b=map(str, sys.stdin.readline().rstrip().split()) p="" q="" for i in range(len(a)): p+=a[len(a)-1-i] for i in range(len(b)): q+=b[len(b)-1-i] p=int(p) q=int(q) print(max(p,q))