백준 2단계 - 3, 4, 7 번

LEE'S·2022년 10월 11일
0

백준

목록 보기
2/27

2단계 3번 (2753번)

year = int(input()) 
if ((year%4==0 and year%100!=0) or year%400==0) :
  print(1)
else :
  print(0)

2단계 4번 (14681번)

x = int(input()) 
y = int(input())

if x>0 : 
  if y>0 :
    print(1)
  else : 
    print(4)

else :
  if y>0 :
    print(2)
  else : 
    print(3)

2단계 7번 (2480번)

a,b,c = input().split()
a = int(a)
b = int(b)
c = int(c)

l = [a,b,c]

if a==b==c :
  print(10000 + a*1000) 
elif a!=b and b!=c and a!=c :
  print(max(l)*100) 
else : 
  if a==b or a==c : print(1000 + 100*a)
  else : print(1000 + 100*b)

🥲 개인적으로 이 세 문제 중에 가장 고민을 많이 했었던 문제였다. 나 같은 경우에는 세 개 모두 같을 때, 모두 다를 때를 먼저 해놓은 후, 두 개만 같을 경우를 따로 빼서 처리했다.

a,b,c = map(int, input().split()) 으로 하면 더 간단하다..!

profile
기록 블로그

0개의 댓글