https://www.acmicpc.net/problem/2783
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringTokenizer st = new StringTokenizer(br.readLine());
double sX = Double.parseDouble(st.nextToken());
double sY = Double.parseDouble(st.nextToken());
double minPrice = 1000 / sY * sX;
int N = Integer.parseInt(br.readLine());
for (int i = 0; i < N; i++) {
st = new StringTokenizer(br.readLine());
double x = Double.parseDouble(st.nextToken());
double y = Double.parseDouble(st.nextToken());
double price = 1000 / y * x;
if (minPrice > price) {
minPrice = price;
}
}
System.out.printf("%.2f",minPrice);
}
}
'알고리즘 > 백준' 카테고리의 다른 글
백준 2857 FBI (0) | 2022.12.07 |
---|---|
백준 9295 주사위 (0) | 2022.12.07 |
백준 14656 조교는 새디스트야!! (0) | 2022.12.06 |
백준 5361 전투 드로이드 가격 (0) | 2022.12.06 |
백준 10409 서버 (0) | 2022.12.06 |