파이썬에서 조건문
if () 괄호 안써도됨
근데 if 뒤에 :를 써줘야됨
중괄호 대신 들여쓰기로 구분
if elif else
&& || 대신 and or
== 같다 != 다르다
#1330 두 수 비교하기
A, B = map(int, input().split())
if A > B:
print(">")
elif A < B:
print("<")
else:
print("==")
#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')
#2753 윤년
year = int(input())
if year % 4 == 0 and (year % 100!= 0 or year % 400 == 0):
print('1')
else:
print('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)
else: print(4)
#2884 알람 시계
h, m = map(int, input().split())
total = 60 * h + m
if total >= 45:
alarm_min = total - 45
else:
alarm_min = total - 45 + 24 * 60
alarm_h = alarm_min // 60
alarm_m = alarm_min % 60
print(alarm_h, alarm_m)
#2525 오븐 시계
h, m = map(int, input().split())
cook_time = int(input())
total_min = 60 * h + m
fin_time = total_min + cook_time
fin_h = fin_time // 60
fin_m = fin_time % 60
if fin_h >= 24:
fin_h -= 24
print(fin_h, fin_m)
#2480 주사위 세개
fir, sec, thr = map(int, input().split())
if fir == sec == thr:
prize = 10000 + fir * 1000
elif fir != sec and sec != thr and fir != thr:
if fir > sec: max = fir
elif sec > fir: max = sec
if(thr > max): max = thr
prize = max * 100
else:
if fir == sec or fir == thr:
prize = 1000 + fir * 100
else:
prize = 1000 + sec * 100
print(prize)
->
a,b,c = map(int, input().split())
if a==b==c:
print(10000+a*1000)
elif a==b or a==c:
print(1000+a*100)
elif b==c:
print(1000+b*100)
else :
print(max(a,b,c)*100)
'파이썬' 카테고리의 다른 글
[백준 단계별 1단계 입출력과 사칙연산 파이썬] 2557, 1000, 1001, 10998, 1008, 10869, 10926, 18108, 10430, 2588, 11382, 10171, 10172 (0) | 2024.01.16 |
---|