분류 전체보기 (49) 썸네일형 리스트형 [백준 4153] 직각삼각형 while True: p,q,r=map(int, input().split()) if p==0 and q==0 and r==0: break a=max(p,q,r) c=min(p,q,r) b=p+q+r-a-c if a**2-b**2-c**2==0: print("right") else : print("wrong") [백준 3009] 네 번째 점 a,b=map(int, input().split()) p,q=map(int, input().split()) x,y=map(int, input().split()) if (a==p and b==y) or (a==x and b==q): print(p+x-a,q+y-b) if (p==a and q==y) or (p==x and q==b): print(a+x-p,b+y-q) if (x==a and y==q) or (x==p and y==b): print(a+p-x,b+q-y) [백준 6064] 카잉 달력 from math import gcd a=int(input()) for i in range(a): m,n,x,y=map(int, input().split()) lcm=int(m*n/gcd(m,n)) k=0 if m b=int(lcm/n) for j in range(b): if (j*n+y-1)%m+1==x: print(j*n+y) k=1 else : b=int(lcm/m) for j in range(b): if (j*m+x-1)%n+1==y: print(j*m+x) k=1 if k==0: print(-1) [백준 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 이전 1 2 3 4 5 6 7 다음