본문 바로가기

코딩테스트/프로그래밍 기초 | 조건문

[코드트리] and, or 혼합

굉장한 숫자

https://www.codetree.ai/missions/4/problems/amazing-number?&utm_source=clipboard&utm_medium=text

n = int(input())

if n % 2 != 0 and n % 3 == 0 or n % 2 == 0 and n % 5 == 0:
    print("true")
else:
    print("false")

 

 

 

 

숫자의 계절은

https://www.codetree.ai/missions/4/problems/season-of-num?&utm_source=clipboard&utm_medium=text

m = int(input())

if m <= 2 or m >= 12:
    print("Winter")
elif m <= 5:
    print("Spring")
elif m <= 8:
    print("Summer")
else:
    print("Fall")

 

 

 

 

장학금

https://www.codetree.ai/missions/4/problems/scholarship?&utm_source=clipboard&utm_medium=text

 

코드트리 | 코딩테스트 준비를 위한 알고리즘 정석

국가대표가 만든 코딩 공부의 가이드북 코딩 왕초보부터 꿈의 직장 코테 합격까지, 국가대표가 엄선한 커리큘럼으로 준비해보세요.

www.codetree.ai

i = input()
j = i.split()
m = int(j[0])
f = int(j[1])

if m >= 90 and f >= 95:
    print("100000")
elif 90 <= f < 95:
    print("50000")
else:
    print("0")

 

 

 

 

좀 더 어려운 수학 점수

https://www.codetree.ai/missions/4/problems/math-scores-are-more-difficult?&utm_source=clipboard&utm_medium=text

a_i = input()
a_j = a_i.split()
b_i = input()
b_j = b_i.split()

a_m = a_j[0]
a_e = a_j[1]
b_m = b_j[0]
b_e = b_j[1]

if a_m > b_m or (a_m == b_m and a_e > b_e):
    print("A")
else:
    print("B")

 

 

 

 

두 사람

https://www.codetree.ai/missions/4/problems/two-person?&utm_source=clipboard&utm_medium=text

f_i = input()
f_j = f_i.split()
f_a = int(f_j[0])
f_s = f_j[1]

s_i = input()
s_j = s_i.split()
s_a = int(s_j[0])
s_s = s_j[1]

if f_a >= 19 and f_s == 'M' or s_a >= 19 and s_s == 'M':
    print(1)
else:
    print(0)