蓝桥杯- 基础练习: 数列特征

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);
    }
}

 

posted @ 2018-01-14 20:38  Bap  阅读(290)  评论(0编辑  收藏  举报