※ 글쓴이는 취미로 코딩을 익혀보는 사람이라 정확하지 않은 내용을 담고 있을 수 있다 ※
이번에 볼 문제는 백준 10185번 문제인 Focus이다.
문제는 아래 링크를 확인하자.
https://www.acmicpc.net/problem/10185
10185번: Focus
There is no longer a STAAR test in physics—the pressure is off! You can just learn physics for the sheer fun of learning about the natural world (and to prepare for college)! To celebrate this fact, here’s a program on lenses. Lenses use refraction of
www.acmicpc.net
문제에 주어진 관계식
해당 식을 이용해 문제를 해결하자.
아래는 제출한 소스코드이다.
#include <iostream>
using namespace std;
typedef long double ld;
int T;
ld p, q;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout << fixed;
cout.precision(1);
cin >> T;
while (T--) {
cin >> p >> q;
cout << "f = " << (1 / ((1 / p) + (1 / q))) << '\n';
}
}
728x90
'BOJ' 카테고리의 다른 글
[BOJ 24310 // C++] БОЯДИСВАНЕ НА ОГРАДА (0) | 2023.01.07 |
---|---|
[BOJ 26946 // C++] Tomater (0) | 2023.01.07 |
[BOJ 22123 // C++] Экзамен (0) | 2023.01.07 |
[BOJ 26583 // C++] Scale (0) | 2023.01.07 |
[BOJ 3554 // C++] Enigmatic Device (0) | 2023.01.07 |