2 条回复
40%的路过
不知道为啥不Ac?
题意理解错了???
不是很懂
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
while(sc.hasNextLine()) {
int a = sc.nextInt();
int b = sc.nextInt();
int x = sc.nextInt();
int y = sc.nextInt();
int[] arr = func(a,b,x,y);
System.out.println(arr[0] + " " + arr[1]);
}
}
private static int[] func(int a, int b, int x, int y) {
int[] arr = new int[2];
if(a < x || b < y) {
return arr;
}
if((a * 1.0 / x) < (b * 1.0 / y)) {
arr[0] = (a / x) * x;
arr[1] = (a / x) * y;
}else {
arr[0] = (b / y) * x;
arr[1] = (b / y) * y;
}
return arr;
}
}
添加回复