반응형
문제 링크
코드
#include <bits/stdc++.h>
using namespace std;
int main(void) {
ios::sync_with_stdio(0);
cin.tie(0);
double ans;
int x, y, n;
cin >> x >> y >> n;
ans = (double)x / y;
while (n--) {
cin >> x >> y;
ans = min((double)x / y, ans);
}
cout << fixed;
cout.precision(2);
cout << ans * 1000;
}
설명
fixed와 precision을 통해서 cout에서 소수점 자릿수를 조절할 수 있다.
(주의) 기록용으로 작성한 글입니다. 좋은 코드가 아닐 수 있습니다.
댓글 환영합니다!
반응형
'Algorithm > BOJ' 카테고리의 다른 글
[백준/BOJ] 2799번 - 블라인드 (C++) (0) | 2022.03.23 |
---|---|
[백준/BOJ] 2798번 - 블랙잭 (C++) (0) | 2022.03.23 |
[백준/BOJ] 2775번 - 부녀회장이 될테야 (C++) (0) | 2022.03.23 |
[백준/BOJ] 2606번 - 바이러스 (C++) (0) | 2022.03.23 |
[백준/BOJ] 2693번 - N번째 큰 수 (C++) (0) | 2022.03.23 |
댓글