Development Project

[ Baekjoon - 단계별로 풀어보기(05/25) ] - 2단계 : 조건문 본문

CodingTest/Baekjoon

[ Baekjoon - 단계별로 풀어보기(05/25) ] - 2단계 : 조건문

나를 위한 시간 2022. 5. 26. 01:37
  • 1330 : 두 수 비교하기
a,b = map(int, input().split())
if a>b:
    print(">")
elif a==b:
	print("==")
else:
	print("<")
#
a,b = map(int, input().split())
print(">" if a>b else ("<" if a<b else "=="))

 

  • 9498 : 시험 성적
score = int(input())
if score >= 90:
    print('A')
elif score >= 80:
    print('B')
elif score >= 70:
    print('C')
elif score >= 60:
    print('D')
else:
    print('F')
#
score = int(input())
print("A" if score>=90 else ("B" if score>=80 else ("C" if score>=70 else ("D" if score>=60 else "F"))))

 

  • 2753 : 윤년
A = int(input())
if (A % 4) == 0 and (A % 100) != 0:
    print("1")
elif A % 400 == 0:
    print("1")
else:
    print("0")
#
year = int(input())
print(1 if (year%4==0 and year%100!=0) else (1 if year%400==0 else 0))

 

  • 14681 : 사분면 고르기
x = int(input())
y = int(input())
if x > 0 and y > 0:
    print(1)
elif x < 0 and y > 0:
    print(2)
elif x < 0 and y < 0:
    print(3)
elif x > 0 and y < 0:
    print(4)
else:
    print('원점')
#
x = int(input())
y = int(input())
print(1 if x>0 and y>0 else (2 if x<0 and y>0 else (3 if x<0 and y<0 else 4)))

 

  • 2884 : 알람 시계
Hour, Minutes = map(int, input().split(" "))
Minutes += Hour * 60
Minutes -= 45
new_hour = ((Minutes // 60) + 24) % 24
new_minutes = Minutes % 60
print(f"{new_hour} {new_minutes}")
#
h, m = map(int, input().split())
print(str(h)+" "+str(m-45) if m>=45 and h!=0 else (str(h)+" "+str(m-45) if m>=45 and h==0  else (str(h-1)+" "+str(m+15) if m<45 and h!=0 else "23 "+str(m+15))))

 

  • 2525 : 오븐 시계
h, m = map(int, input().split())
cook = int(input())   
h += cook//60    
m += cook%60    

if m>=60:
    h+=1
    m-=60

if h>23:
    h = h-24 

print(h,m)
#
A, B = map(int, input().split())
C = int(input()) 
minute = B+C
hour = (A + minute//60)%24
minute = minute%60
print(hour, minute)

 

  • 2480 : 주사위 세개
a,b,c=map(int, input().split())
print(10000+a*1000 if a==b==c else (1000+a*100 if a==b or a==c else (1000+b*100 if b==c else (a*100 if a>b and a>c else(b*100 if b>a and b>c else c*100)))))
#
a,b,c=map(int, input().split())
if (a==b==c):
    print(10000+a*1000)
elif (a==b or b==c):
    print(1000 + b*100)
elif (c==a):
    print(1000 + c*100)
else:
    arr=sorted([a,b,c])
    print(arr[2]*100)
Comments