2765번 - 자전거 속도
문제의 출력 부분입니다.
각각의 데이터에 대해 다음을 출력한다
Trip #N: distance MPH
N은 각각의 데이터 번호를 출력해야 하며, distance는 총 거리(Miles)를 소수 둘째 자리까지 반올림하여 나타내며, MPH는 평균 속도(miles per hour)를 소수 둘째 자리까지 반올림하여 나타낸다. 회전수가 0인 데이터에 대해서는 출력하지 않는다.
원본 문제의 출력 부분입니다.
For each data set, print:
Of course N should be replaced by the data set number, distance by the total distance in miles (accurate to 2 decimal places)
and MPH by the speed in miles per hour (accurate to 2 decimal places). Your program should not
generate any output for the ending case when revolutions is 0.
소수점 둘째 자리 까지 출력하고, 반올림은 하지 않아도 되는 것 같아 보입니다.
둘째 자리까지 출력하려면 반올림을 해야 합니다.
혹시 "%.2lf"처럼 둘째 자리까지 출력하는 방식이 반올림을 적용시켜 주는 방식인가요? 따로 반올림 처리하지 않고 저렇게 출력하니깐 맞았다고 떠서 궁금합니다.
네.
감사합니다. 이렇게 또 새로운걸 알아가네요.
댓글을 작성하려면 로그인해야 합니다.
cko301 4년 전
문제의 출력 부분입니다.
각각의 데이터에 대해 다음을 출력한다
Trip #N: distance MPH
N은 각각의 데이터 번호를 출력해야 하며, distance는 총 거리(Miles)를 소수 둘째 자리까지 반올림하여 나타내며, MPH는 평균 속도(miles per hour)를 소수 둘째 자리까지 반올림하여 나타낸다. 회전수가 0인 데이터에 대해서는 출력하지 않는다.
원본 문제의 출력 부분입니다.
For each data set, print:
Trip #N: distance MPH
Of course N should be replaced by the data set number, distance by the total distance in miles (accurate to 2 decimal places)
and MPH by the speed in miles per hour (accurate to 2 decimal places). Your program should not
generate any output for the ending case when revolutions is 0.
소수점 둘째 자리 까지 출력하고, 반올림은 하지 않아도 되는 것 같아 보입니다.