728x90
문제 링크: https://www.acmicpc.net/problem/4766
4766번: 일반 화학 실험
입력은 동혁이가 측정한 혼합물의 온도가 순서대로 주어진다. 온도는 -10도와 200도 사이이고, 소수점 둘째자리까지 적혀져 있을 수도 있다. 마지막 측정 후에는 999가 주어진다. 동혁이는 온도를
www.acmicpc.net
문제 풀이
간단한 구현 문제이다. 반복문으로 전의 값을 빼주면 된다. 소수도 들어올 수 있으니 처리에 주의하자.
코드
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = float(input()) | |
while True: | |
a = input() | |
if a == '999': | |
break | |
print('%.2f' %(float(a)-s)) | |
s = float(a) |
728x90
'BOJ' 카테고리의 다른 글
[BOJ][Python] 백준 14502번 - 연구소 (0) | 2021.09.24 |
---|---|
[BOJ][Python] 백준 2174번 - 로봇 시뮬레이션 (0) | 2021.09.24 |
[BOJ][Python] 백준 18301번 - Rats (2) | 2021.09.23 |
[BOJ][Python] 백준 21300번 - Bottle Return (0) | 2021.09.23 |
[BOJ][Text] 백준 18096번 - Арифметическая магия (0) | 2021.09.23 |