不保存到数组,时间O(n),空间O(1)。不到双百。 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); long cur = 0, max = Integer.MIN_VALUE; int n = in.nextInt(); for (int i=0; i<n; ++i) { i...