반응형
5355번: 화성 수학
겨울 방학에 달에 다녀온 상근이는 여름 방학 때는 화성에 갔다 올 예정이다. (3996번) 화성에서는 지구와는 조금 다른 연산자 @, %, #을 사용한다. @는 3을 곱하고, %는 5를 더하며, #는 7을 빼는 연산
www.acmicpc.net
# @Author YoungMinKim
# baekjoon
import sys
N = int(sys.stdin.readline())
for _ in range(N):
x = list(sys.stdin.readline().split())
try:
if x[0].split('.'):
num=float(x[0])
except:
num = int(x[0])
for i in x[1:]:
if i == '@':
num*=3
elif i == '%':
num+=5
else:
num -= 7
print('%.2f'%num)
반응형
'백준 문제풀이' 카테고리의 다른 글
| baekjoon - python - 19602 (0) | 2020.10.14 |
|---|---|
| baekjoon - python - 18108 (0) | 2020.10.14 |
| baekjoon - python - 10845 (0) | 2020.10.10 |
| baekjoon - python - 1920 (0) | 2020.10.10 |
| baekjoon - python - 10815 (0) | 2020.10.10 |
댓글