728x90
반응형

단순 구현 문제이다.

for _ in range(int(input())):
    n = int(input())
    print(f"Pairs for {n}:", end=' ')
    for i in range(1, n//2+1):
        if i != n-i:
            if i != 1:
                print(',', end=' ')
            print(i, n-i, end='')
    print()
728x90
반응형
728x90
반응형

단순 구현 문제이다.

while 1:
    li = sorted(list(map(int, input().split())))
    if li[0] == li[1] == li[2] == 0:
        break
    if li[0]+li[1] <= li[2]:
        print("Invalid")
    elif li[0] == li[1] == li[2]:
        print("Equilateral")
    elif li[0]==li[1] or li[1]==li[2] or li[2]==li[0]:
        print("Isosceles")
    else:
        print("Scalene")
728x90
반응형
728x90
반응형

단순 사칙연산 문제이다.

i = 1
while 1:
    n0 = int(input())
    if n0 == 0:
        break
    n1 = 3*n0
    n2 = (n1+1)//2 if n1%2 else n1//2
    n3 = 3*n2
    n4 = n3//9
    if n0 == 2*n4:
        print(f"{i}. even {n4}")
    else:
        print(f"{i}. odd {n4}")
    i += 1
728x90
반응형
728x90
반응형

단순 구현 문제이다.

while 1:
    sp, w, st = map(float, input().split())
    p = 0
    if sp == w == st == 0:
        break
    if sp <= 4.5 and w >= 150 and st >= 200:
        p = 1; print("Wide Receiver", end = ' ')
    if sp <= 6.0 and w >= 300 and st >= 500:
        p = 1; print("Lineman", end = ' ')
    if sp <= 5.0 and w >= 200 and st >= 300:
        p = 1; print("Quarterback", end = ' ')
    if p == 0:
        print("No positions", end = ' ')
    print()
728x90
반응형
728x90
반응형

단순 구현 문제이다. Python3로 제출하니까 시간 초과가 떠서 PyPy3로 제출했다.

for a in range(6,101):
    for b in range(2,101):
        for c in range(b+1,101):
            for d in range(c+1,101):
                if a**3 == b**3 + c**3 + d**3:
                    print(f"Cube = {a}, Triple = ({b},{c},{d})")
                if a**3 < b**3 + c**3 + d**3:
                    break
728x90
반응형
728x90
반응형

단순 구현 문제이다.

for _ in range(int(input())):
    n = int(input())
    p1 = p2 = 0
    for i in range(n):
        a, b = input().split()
        if a == b:
            continue
        elif (a == 'R' and b == 'S') or (a == 'P' and b == 'R') or (a == 'S' and b == 'P'):
            p1 += 1
        else:
            p2 += 1
    if p1 > p2:
        print("Player 1")
    elif p1 < p2:
        print("Player 2")
    else:
        print("TIE")
728x90
반응형
728x90
반응형

단순 사칙연산 문제이다.

while 1:
    a, b = map(int, input().split())
    if a == b == 0:
        break
    print("Yes" if a > b else "No")
728x90
반응형
728x90
반응형

단순 사칙연산 문제이다.

while 1:
    a, b, c, d = map(int, input().split())
    if a == b == c == d == 0:
        break
    cnt = 0
    while not (a == b == c == d):
        a, b, c, d = abs(a-b), abs(b-c), abs(c-d), abs(d-a)
        cnt += 1
    print(cnt)
728x90
반응형
728x90
반응형

단순 구현 문제이다.

for _ in range(int(input())):
    a, b = input().split()
    a, b = int(a[::-1]), int(b[::-1])
    res = int(str(a+b)[::-1])
    print(res)
728x90
반응형
728x90
반응형

단순 수학 문제이다.

for _ in range(int(input())):
    li = list(map(int, input().split()))
    even_li = []
    for n in li:
        if n%2 == 0:
            even_li.append(n)
    print(sum(even_li), min(even_li))
728x90
반응형
728x90
반응형

단순 수학 문제이다.

h1, m1, s1 = map(int, input().split(':'))
h2, m2, s2 = map(int, input().split(':'))
t1 = h1*60*60 + m1*60 + s1
t2 = h2*60*60 + m2*60 + s2
t = t2 - t1 if t2 > t1 else t2-t1+24*60*60
h = t//60//60
m = t//60 % 60
s = t%60
print("%02d:%02d:%02d" % (h, m, s))
728x90
반응형
728x90
반응형

단순 구현 문제이다.

li = [1, 0, 0]
s = input()
for c in s:
    if c == 'A':
        li[0], li[1] = li[1], li[0]
    elif c == 'B':
        li[1], li[2] = li[2], li[1]
    else:
        li[0], li[2] = li[2], li[0]
print(li.index(1) + 1)
728x90
반응형
728x90
반응형

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

a, b, c = map(int, input().split())
if a+b == c:
    print(f"{a}+{b}={c}")
elif a-b == c:
    print(f"{a}-{b}={c}")
elif a*b == c:
    print(f"{a}*{b}={c}")
elif a//b == c:
    print(f"{a}/{b}={c}")
elif a == b+c:
    print(f"{a}={b}+{c}")
elif a == b-c:
    print(f"{a}={b}-{c}")
elif a == b*c:
    print(f"{a}={b}*{c}")
elif a == b//c:
    print(f"{a}={b}/{c}")
728x90
반응형
728x90
반응형

최대값 찾기 문제이다.

max_s = max_i = 0
for i in range(5):
    s = sum(map(int, input().split()))
    if s > max_s:
        max_s = s
        max_i = i+1
print(max_i, max_s)
728x90
반응형
728x90
반응형

단순 수학 문제이다.

N, M, K = map(int, input().split())
for _ in range(K):
    if N//2 < M:
        M -= 1
    else:
        N -= 1
print(min(N//2, M))
728x90
반응형

+ Recent posts