18406 : 럭키스트레이트

서희찬·2022년 1월 19일
0

백준

목록 보기
93/105

문제

코드

1

score =input()
halfLength = len(score)//2 
front = score[:halfLength] ; back = score[halfLength:]
frontScore = 0 ; backScore = 0 

for fronts in front:
    frontScore+=int(fronts)
for backs in back:
    backScore+=int(backs)

if frontScore == backScore:
    print("LUCKY")
else :
    print("READY")

2

score = input()
front,back = 0,0 
for i in score[:len(score)//2]:front+=int(i)
for i in score[len(score)//2:]:back+=int(i)
print("LUCKY" if front==back else "READY")

해설

string으로 받고 문자열로 잘라주고 int로 변수에 더해주면서 비교하는 문제이다..
파이썬의 세계란...

profile
부족한 실력을 엉덩이 힘으로 채워나가는 개발자 서희찬입니다 :)

0개의 댓글