62,614
社区成员
发帖
与我相关
我的任务
分享
public class Test {
public static void main(String[] args) {
// TODO Auto-generated method stub
for (int i = 0; i <= 10; i++) {
for (int j = 0; j <= 500; j++) {
int z = i + 500;
if (z > i + j && i + 500 == j + 10) {
System.out.print("哥哥:"+i+"分 ");
System.out.print("第第:"+j+"分 ");
System.out.println("price:"+z+"分");
}
}
}
}
}
5<=书<5.1
public static void brotherBuyBook() {
java.text.DecimalFormat df = new java.text.DecimalFormat("#0.00");
double bookPrice = 0.0d;
double oldBrother = 0.0d, litteBrother = 0.0d;
while (true) {
bookPrice += 0.01;
bookPrice = Double.parseDouble(df.format(bookPrice));
oldBrother = bookPrice - 5;
oldBrother = Double.parseDouble(df.format(oldBrother));
litteBrother = (bookPrice - 0.1);
litteBrother = Double.parseDouble(df.format(litteBrother));
if ((oldBrother + litteBrother) < bookPrice && litteBrother > 0
&& oldBrother > 0)
break;
// System.out.println("bookPrice: " + bookPrice);
}
System.out.println("oldBrother:" + oldBrother);
System.out.println("litteBrother:" + litteBrother);
System.out.println("bookPrice: " + bookPrice);
}