Topcoder SRM 479 "TheAirTripDivTwo"
問題:http://www.topcoder.com/stat?c=problem_statement&pm=11031 (要ログイン)
とりあえず貼っとく.
public class TheAirTripDivTwo { public int find(int[] flights, int fuel) { int i = 0; for(;i<flights.length; ++i){ if((fuel -= flights[i])<0){ break; } } return i; } }