1.有浮点数,尽量转换为 整数做题。浮点数 “==” 相差不大,即相等
import java.io.IOException;
/**
* @author Zuck
*
*/
public class two {
/**
* @param args
*/
public static void main(String[] args) throws IOException {
// TODO Auto-generated method stub
// for(int a=1;a<40;a++)
// for(int b=1;b<45;b++)
// if (a*2.3+b*1.9==82.3 && a<b) {
// System.out.println(a);
// System.out.print(b);
// }
for(int a=1;a<40;a++)
for(int b=1;b<45;b++)
if (a*23+b*19==823 && a<b) {
System.out.println(a);
System.out.print(b);
}
}
}
1.看题,说 每次 都有人 倒下了。那就是 每次都有人倒下了,不能 自以为是