网易运筹优化笔试,编程题第3题题解:import java.util.Scanner;public class Main{ public static void main(String args[]){ Scanner cin = new Scanner(System.in); int n = cin.nextInt(); for(int i = 0; i int num = cin.nextInt(); int[] f = new int[num+1]; //表示前i个人需要的最短时间 //读入单个时间和双人时间 int[] one = new int[num+1]; int[] two = new int[num+1]; for(int j = 1; j one[j] = cin.nextInt(); } for(int k = 2; k two[k] = cin.nextInt(); } f[1] = one[1]; for(int j = 2; j f[j] = Math.min(f[j - 1] + one[j], f[j - 2] + two[j]); } System.out.println(getS(f[num])); } }}