蓝桥杯- 基础练习: 数列特征
import java.util.Scanner; public class Main { public static void main(String[] args) { long min = 0; long max = 0; long add = 0; Scanner scanner = new Scanner(System.in); int size = scanner.nextInt(); long ints[] = new long[size]; for (int i = 0; i < size; i++) { ints[i] = scanner.nextInt(); } min = max = ints[0]; for (int i = 0; i < ints.length; i++) { add += ints[i]; if (max<ints[i]) { max = ints[i]; } if (min>ints[i]) { min = ints[i]; } } System.out.println(max); System.out.println(min); System.out.println(add); } }