알고리즘/BOJ

백준 9317번 Monitor DPI

꾸준함. 2021. 7. 7. 22:51

문제 링크입니다: https://www.acmicpc.net/problem/9317

 

9317번: Monitor DPI

Each input line will have 3 numbers, the decimal value D, the integer value \(\text{Resolution}_{\text{Horizontal}}\), and the integer value \(\text{Resolution}_{\text{Vertical}}\). An input line of three zeroes will signify end of input

www.acmicpc.net

간단한 수학 문제였습니다.

 

#include <iostream>
#include <cmath>
using namespace std;
int main(void)
{
while (1)
{
double d, rh, rv;
cin >> d >> rh >> rv;
if (d == 0 && rh == 0 && rv == 0)
{
break;
}
double W = 16 * d / sqrt(337);
double H = 9 * W / 16;
double horizontalDPI = rh / W;
double verticalDPI = rv / H;
printf("Horizontal DPI: %.2lf\nVertical DPI: %.2lf\n", horizontalDPI, verticalDPI);
}
return 0;
}
view raw .cpp hosted with ❤ by GitHub

 

개발환경:Visual Studio 2017

 

지적, 조언, 질문 환영입니다! 댓글 남겨주세요~

반응형

'알고리즘 > BOJ' 카테고리의 다른 글

백준 9366번 삼각형 분류  (0) 2021.07.12
백준 9325번 얼마?  (0) 2021.07.11
백준 9316번 Hello Judge  (0) 2021.07.06
백준 9310번 Arithmetic and Geometric Sums  (0) 2021.07.05
백준 9299번 Math Tutoring  (0) 2021.07.04