728x90
반응형

단순 수학 문제이다.

n이 홀수 -> 합이 홀수, 짝수 둘 다 가능함
EX) n = 3
1 + 2 + 3 = 6, 
2 + 3 + 4 = 9

n이 짝수 -> 경우가 두 가지로 나뉨
n//2%2 = 1 -> 합이 홀수임
EX) n = 6
1 + 2 + 3 + 4 + 5 + 6 = (6+1)*3 = 7*3 = 21
2 + 3 + 4 + 5 + 6 + 7 = (7+2)*3 = 9*3 = 27

n//2%2 = 0 -> 합이 짝수임
EX) n = 4
1 + 2 + 3 + 4 = (4+1)*2 = 5*2 = 10
2 + 3 + 4 + 5 = (5+2)*2 = 7*2 = 14

n = int(input())
if n%2:
    res = 0
elif n//2%2 == 0:
    res = 2
else:
    res = 1
print(res)
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
반응형

단순 사칙연산 문제이다.

n, h, v = map(int, input().split())
res = max(h, n-h) * max(v, n-v)
print(res*4)
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
반응형

단순 수학 문제이다.

n = int(input())
if n <= 5:
    print(n)
else:
    if (n-5)//4 % 2 == 0:
        print(5 - (n-5)%4)
    else:
        print(1 + (n-5)%4)
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
반응형

단순 사칙연산 문제이다.

t, p = map(int, input().split())
if p > 20:
    a = t/(100-p)
    print((p-20)*a + 20*2*a)
else:
    a = t / ((20-p)*2 + 80)
    print(p*2*a)
728x90
반응형
728x90
반응형

단순 수학 문제이다.

a = int(input())
print(a**0.5 * 4)
728x90
반응형
728x90
반응형

단순 수학 문제이다.

d1 = int(input())
d2 = int(input())
pi = 3.141592
ans = d1*2 + 2*d2*pi
print(ans)
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
반응형
728x90
반응형

단순 사칙연산 문제이다.

a, b = map(int, input().split())
c, d = divmod(a, b)
if a != 0 and b < 0:
    c, d = c+1, d-b
print(c)
print(d)
728x90
반응형

+ Recent posts