import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner sc=new Scanner(System.in); while(sc.hasNext()){ int n=sc.nextInt(); int max=Integer.MIN_VALUE, max2=Integer.MIN_VALUE; int min1=Integer.MAX_VALUE, min2=Integer.MAX_VALUE; for (int i = 0; i < n; i++) { int a = sc.nextInt(); if(a>max){ max2=max; max=a; } else if(a>max2){ max2=a; } if(a<min1){ min2=min1; min1=a; } else if(a<min2){ min2=a; } } if(min1>=0){ System.out.println(min1*min2); } else if(max<=0){ System.out.println(max*max2); } else{ System.out.println(min1*max); } } } }
0.0分
0 人评分
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:552 |
C语言训练-排序问题<2> (C++代码)浏览:880 |
蓝桥杯历届试题-九宫重排 (C++代码)浏览:2783 |
剪刀石头布 (C语言代码)不知道怎么直接在scanf中用枚举变量浏览:1307 |
输出正反三角形 (C语言代码)浏览:782 |
C语言程序设计教程(第三版)课后习题8.6 (C语言代码)浏览:578 |
简单的for循环浏览:1408 |
C语言程序设计教程(第三版)课后习题5.7 (C语言代码)浏览:1144 |
C语言程序设计教程(第三版)课后习题10.4 (C语言代码)浏览:535 |
C语言程序设计教程(第三版)课后习题1.5 (C语言代码)浏览:460 |