2019-05-22
public class Test {
public static void main(String[] args) {
for (int i = 1; i < 150; i++) {
int aCount = i;
int bCount = 150 - i;
int aPrice = 2450 / bCount;
int bPrice = 3200 / aCount;
if (aCount * aPrice == bCount * bPrice) {
System.out.printf("A(Count:%s, Price:%s分)", aCount, aPrice);
System.out.printf("B(Count:%s, Price:%s分)", bCount, bPrice);
}
}
}
}
求出一组结果。
public class Test {
public static void main(String[] args) {
for (int i = 1; i < 150; i++) {
int aCount = i;
int bCount = 150 - i;
int aPrice = 2450 / bCount;
int bPrice = 3200 / aCount;
if (aCount * aPrice == bCount * bPrice) {
System.out.printf("A(Count:%s, Price:%s分)", aCount, aPrice);
System.out.printf("B(Count:%s, Price:%s分)", bCount, bPrice);
}
}
}
}
求出一组结果。