| 关于蚂蚁问题(Ants) |
|
| 作者是 dreamingnest | |
| 2008-05-10 21:22:59 | |
public class Ant { public static void main(String[] args){ int length=27,points=5,min=0,max=0,temp_min=0,temp_max=0; int[] pos={3,7,11,17,23}; for(int i: pos){ temp_min=i>length-i?length-i:i; temp_max=i<length-i?length-i:i; if(temp_min>min) min=temp_min; if(temp_max>max) max=temp_max; } System.out.println("最短时间:"+min+" 最长时间:"+max); } } |
|
| 最近更新 ( 2008-05-10 21:22:59 ) |





}
}