문제 링크입니다: www.acmicpc.net/problem/14065
14065번: Gorivo
Mirko je nedavno otputovao u Ameriku i tamo je iznajmio moderan američki kabriolet narančaste boje s bijelim crtama, automatskim mjenjačem, navigacijom, i . . . prikaznikom na engleskom jeziku s imperijalnim sustavom mjera. Najviše ga muči to što je
www.acmicpc.net
x (MILES/GALLON) = x * 3.785411784 / 1.609344 (L/KM)
따라서, 100KM/L = 100 / (x * 3.785411784 / 1.609344)
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
#include <iostream> | |
using namespace std; | |
const double GALLON2LITER = 3.785411784; | |
const double MILE2KM = 1.609344; | |
const double HUNDRED_KM = 100.00; | |
int main(void) | |
{ | |
ios_base::sync_with_stdio(0); | |
cin.tie(0); | |
double milesPerGallon; | |
cin >> milesPerGallon; | |
double result = HUNDRED_KM / ((MILE2KM / GALLON2LITER) * milesPerGallon); | |
printf("%.6lf\n", result); | |
return 0; | |
} |


개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
백준 14264번 정육각형과 삼각형 (0) | 2021.03.17 |
---|---|
백준 14173번 Square Pasture (0) | 2021.03.16 |
백준 14038번 Tournament Selection (0) | 2021.03.16 |
백준 13985번 Equality (0) | 2021.03.16 |
백준 13866번 팀 나누기 (0) | 2021.03.16 |