본문 바로가기
python-algorithm

[백준] 1439

by 무적김두칠 2021. 2. 8.

1
2
3
4
5
6
s=input()
cnt=0
for i in range(len(s)-1):
    if s[i]=='0' and s[i+1]=='1' :cnt+=1
    if s[i] == '1' and s[i + 1== '0': cnt += 1
print((cnt+1)//2)
cs

 

반응형

'python-algorithm' 카테고리의 다른 글

[백준] 1316  (0) 2021.02.19
[백준] 1237  (0) 2021.02.19
[백준] 1427  (0) 2021.02.08
[백준] 1246  (0) 2021.02.08
[백준] 1181  (0) 2021.02.08

댓글