首页 > 其他 > 详细

基础练习 数列特征

时间:2016-11-15 23:36:22      阅读:280      评论:0      收藏:0      [点我收藏+]

技术分享

技术分享

 

-----------------------------------

Collections.sort(list);是个好东西

但是要学会排列

然后你才能浪

-----------------------------------

算法

 1 import java.util.*;
 2 public class Main {
 3     public static void main(String[] args) {
 4         Scanner sc = new Scanner(System.in);
 5         ArrayList<Integer> list = new ArrayList<Integer>();
 6         int n = sc.nextInt();
 7         for(int i=0;i<n;i++)
 8             list.add(sc.nextInt());
 9         Collections.sort(list);
10         System.out.println(list.get(list.size()-1));
11         System.out.println(list.get(0));
12         int x = 0;
13         for(int i:list)
14             x += i;
15         System.out.println(x);
16     }
17 }

 

 

 

 

 

 

 

基础练习 数列特征

原文:http://www.cnblogs.com/loveluking/p/6067592.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!