解题思路:
注意事项:
参考代码:import java.util.Scanner;
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner sc=new Scanner(System.in);
long n=sc.nextLong();
long a=sc.nextLong();
long x=a,y=a;
for(long i=1;i<n;i++) {
a=sc.nextLong();
if(a>=x) {
x=a;
}
if(a<=y) {
y=a;
}
}
System.out.printf("%d %d", x, y);
}
}
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题11.3 (C语言代码)浏览:1052 |
Hello, world! (C语言代码)浏览:1196 |
C语言程序设计教程(第三版)课后习题10.5 (C语言代码)浏览:1432 |
买不到的数目 (C++代码)浏览:862 |
C语言程序设计教程(第三版)课后习题7.4 (C语言代码)浏览:604 |
2003年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:539 |
最长单词 (C语言代码)浏览:1362 |
【偶数求和】 (C语言代码)浏览:556 |
三角形 (C++代码)记忆化搜索浏览:1220 |
【计算直线的交点数】 (C语言代码)浏览:1442 |