DANIELOGIC
[Python] 백준 7567번 그릇 본문
[Python] 백준 7567번 그릇
https://www.acmicpc.net/problem/7567
문제

코드
a = input()
s = len(a)
sum = 10
for i in range(s-1):
if a[i] == a[i+1]:
sum += 5
else:
sum += 10
print(sum)
다른 풀이
a = input()
num = 0
b = 0
for i in a:
if i == b:
num += 5
else:
num += 10
b = i
print(num)'Algorithm > 백준' 카테고리의 다른 글
| [Python] 백준 5635번 생일 (0) | 2024.06.23 |
|---|---|
| [Python] 백준 1977번 완전제곱수 (0) | 2024.06.23 |
| [Python] 백준 11557번 Yangjojang of The Year (0) | 2024.06.23 |
| [Python] 백준 2884번 알람 시계 (0) | 2024.06.23 |
| [Python] 백준 2754번 학점계산 (0) | 2024.06.23 |