728x90
반응형

단순 구현 문제이다.

while 1:
    N = input()
    if N == '0':
        break
    res = len(N)+1
    for n in N:
        if n == '0':
            res += 4 
        elif n == '1':
            res += 2
        else:
            res += 3
    print(res)
728x90
반응형
728x90
반응형

단순 구현 문제이다.

p = int(input())
q = int(input())
if p <= 50 and q <= 10:
    print("White")
elif q > 30:
    print("Red")
else:
    print("Yellow")
728x90
반응형
728x90
반응형

단순 구현 문제이다. 노가다...

y = int(input())
d = {1995: "ITMO", 1996: "SPbSU", 1997: "SPbSU", 1998: "ITMO", \
     1999: "ITMO", 2000: "SPbSU", 2001: "ITMO", 2002: "ITMO", \
     2003: "ITMO", 2004: "ITMO", 2005: "ITMO", 2006: "PetrSU, ITMO", \
     2007: "SPbSU", 2008: "SPbSU", 2009: "ITMO", 2010: 'ITMO', \
     2011: 'ITMO', 2012: 'ITMO', 2013: "SPbSU", 2014: "ITMO", \
     2015: "ITMO", 2016: "ITMO", 2017: "ITMO", 2018: "SPbSU", 2019: "ITMO"}
print(d[y])
728x90
반응형
728x90
반응형

단순 구현 문제이다.

N, M = map(int, input().split())
if M <= 2:
    print("NEWBIE!")
elif M > 2 and M <= N:
    print("OLDBIE!")
else:
    print("TLE!")
728x90
반응형
728x90
반응형

단순 구현 문제이다. 

사실 L <= R 조건 때문에 답은 항상 X, L, R을 정렬한 결과의 중간값이 된다.

1. X가 제일 작을 경우 -> 정렬 결과: X, L, R -> X와 제일 가까운 수는 L

2. X가 중간값일 경우 -> 정렬 결과: L, X, R -> X와 제일 가까운 수는 X

3. X가 제일 클 경우 -> 정렬 결과: L, R, X -> X와 제일 가까운 수는 R

답이 모두 X, L, R을 정렬한 결과의 중간값이 된다.

 

print(sorted(map(int, input().split()))[1])
X, L, R = map(int, input().split())
res = 0
m = 100000
for n in range(L, R+1):
    if abs(X-n) < m:
        m = abs(X-n)
        res = n
print(res)
728x90
반응형
728x90
반응형

단순 사칙연산 문제이다.

li = sorted(map(int, input().split()), reverse=True)
print(sum(li[:2]))
728x90
반응형
728x90
반응형

단순 구현 문제이다.

A, B, C = map(int, input().split())
print(2 if A+B+C > 4 else 1)
A, B, C = map(int, input().split())
li = [A, B, C]
print(1 if li.count(1) > li.count(2) else 2)
728x90
반응형
728x90
반응형

단순 구현 문제이다.

m, n = map(int, input().split())
print("satisfactory" if m >= 8 else "unsatisfactory")

사실 m이 8 이상이면 satisfactory 8 미만이면 unsatisfactory 출력하는게 끝인데

아래 코드 같이 삽질을 하기도 했다. 아래 코드도 통과된다.

m, n = map(int, input().split())
check = 0
for _ in range(m):
    a, b, c = map(int, input().split())
    a = 1 if a > 0 else 0
    b = 1 if a > 0 else 0
    c = 1 if a > 0 else 0    
    if (not a or b or c) and (not a or not b or c) and (a or not b or c) \
        and (a or not b or not c) and (a or b or c) and m >= 8:
        check = 1
print("satisfactory" if check else "unsatisfactory")
728x90
반응형
728x90
반응형

단순 구혆 문자이다.

print("YES" if input()[:3] == "555" else "NO")
728x90
반응형
728x90
반응형

단순 구현 문제이다.

S, K, H = map(int, input().split())
d = {S: "Soongsil", K: "Korea", H: "Hanyang"}
if sum(d) >= 100:
    print("OK")
else:
    print(d[min(d)])
728x90
반응형
728x90
반응형

단순 사칙연산 문제이다.

li1 = [int(input()) for _ in range(3)]
li2 = [int(input()) for _ in range(3)]
A = li1[0]*3 + li1[1]*2 + li1[2]
B = li2[0]*3 + li2[1]*2 + li2[2]
if A == B:
    print("T")
elif A > B:
    print("A")
else:
    print("B")
728x90
반응형
728x90
반응형

단순 수학 문제이다.

A, B, C = map(int, input().split())
cnt = total = 0
while total < C:
    total += A
    cnt += 1
    if cnt%7 == 0:
        total += B
print(cnt)
728x90
반응형
728x90
반응형

단순 구현 문제이다.

p1, s1 = map(int, input().split())
s2, p2 = map(int, input().split())
p = p1+p2
s = s1+s2
if p == s:
    if p1 == s2:
        print("Penalty")
    elif p1 > s2:
        print("Esteghlal")        
    else:
        print("Persepolis")
elif p > s:
    print("Persepolis")
else:
    print("Esteghlal")
728x90
반응형
728x90
반응형

단순 사칙연산 문제이다.

from math import pi

A1, P1 = map(int, input().split())
R1, P2 = map(int, input().split())
if P1/A1 < P2/(R1**2*pi):
    print("Slice of pizza")
else:
    print("Whole pizza")
728x90
반응형
728x90
반응형

단순 수학 문제이다.

Br, Bc = map(int, input().split())
Dr, Dc = map(int, input().split())
Jr, Jc = map(int, input().split())
B = max(abs(Jr-Br), abs(Jc-Bc))
D = abs(Jr-Dr) + abs(Jc-Dc)
if B == D:
    print("tie")
elif B < D:
    print("bessie")
else:
    print("daisy")
728x90
반응형

+ Recent posts