백준 - 문제집 <Python 배우기 (31~40)>

유다송·2022년 8월 24일
0

31번

k, n, m = map(int, input().split())
print((k * n - m) if (k * n - m) >= 0 else 0)

32번

x1, y1 = map(int, input().split())
x2, y2 = map(int, input().split())
x3, y3 = map(int, input().split())

if(x1 == x2):
    x4 = x3
elif(x1 == x3):
    x4 = x2
else:
    x4 = x1
    
if(y1 == y2):
    y4 = y3
elif(y1 == y3):
    y4 = y2
else:
    y4 = y1
    
print(x4, y4)

33번

n = int(input())
answer = 0
for i in range(n):
    a, b, c = map(int, input().split())
    
    if a == b == c:
        answer = max(answer, 10000+a*1000)
    elif a == b:
        answer = max(answer, 1000+a*100)
    elif c == b:
        answer = max(answer, 1000+b*100)
    elif a == c:
        answer = max(answer, 1000+a*100)    
    else:
        answer = max(answer, max(a,b,c) * 100)
        
print(answer)

34번

dic = {'A+':'4.3', 'A0':'4.0', 'A-':'3.7',
       'B+':'3.3', 'B0':'3.0', 'B-':'2.7',
       'C+':'2.3', 'C0':'2.0', 'C-':'1.7',
       'D+':'1.3', 'D0':'1.0', 'D-':'0.7',
       'F':'0.0'}
grade = input()
print(dic[grade])
  • 딕셔너리 이용해서 풀기

35번

h, m = map(int, input().split())
if m > 44:
    print(h, m-45)

elif m < 45 and h > 0:
    print(h-1, m+15)

else:
    print(23, m+15)

36번

bowl = list(input())
high = 10
for i in range(1, len(bowl)):
    if bowl[i] == bowl[i - 1]:
        high += 5
    else:
        high += 10
        
print(high)

37번

n = int(input())
for i in range(n):
    r, e, c = map(int, input().split())
    if r > e - c:
        print("do not advertise")
    elif r == e - c:
        print("does not matter")
    else:
        print("advertise")

38번

v = int(input())
vote = list(str(input()))

a = b = 0
for v in vote:
    if v == "A":
        a += 1
    else:
        b += 1
if a > b:
    print("A")
elif a == b:
    print("Tie")
else:
    print("B")

39번

n = int(input())
a = b = 0
for i in range(n):
    v = int(input())
    if v == 1:
        a += 1
    else:
        b += 1
        
if a > b:
    print("Junhee is cute!")
else:
    print("Junhee is not cute!")

40번

a = input()
print(1 if a == a[::-1] else 0)

0개의 댓글