문제 링크입니다: https://www.acmicpc.net/problem/9469
9469번: 폰 노이만
250마일 길이의 철로 양 끝에 두 기차 A와 B가 있다. A는 시속 10마일, B는 시속 15마일로 서로를 향해 출발했다. 두 기차의 출발과 동시에 기차 A 앞에 붙어있던 파리 한 마리가 기차가 충돌할 때 까
www.acmicpc.net
폰 노이만과 파리 문제에 관련 일화는 아래 링크를 참고해주시면 됩니다.
https://m.blog.naver.com/PostView.naver?isHttpsRedirect=true&blogId=ysuny2&logNo=221260564944
This file contains hidden or 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; | |
int main(void) | |
{ | |
int P; | |
cin >> P; | |
for (int p = 1;p <= P; p++) | |
{ | |
int N; | |
double D, A, B, F; | |
cin >> N >> D >> A >> B >> F; | |
double duration = D / (A + B); | |
double result = F * duration; | |
printf("%d %.3lf\n", N, result); | |
} | |
return 0; | |
} |

개발환경:Visual Studio 2017
지적, 조언, 질문 환영입니다! 댓글 남겨주세요~
반응형
'알고리즘 > BOJ' 카테고리의 다른 글
백준 4562번 No Brainer (1) | 2021.07.22 |
---|---|
백준 9493번 길면 기차, 기차는 빨라, 빠른 것은 비행기 (0) | 2021.07.20 |
백준 9449번 Garage (1) | 2021.07.18 |
백준 9437번 사라진 페이지 찾기 (0) | 2021.07.17 |
백준 9366번 삼각형 분류 (0) | 2021.07.12 |