summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AlgoDesignAndTechniqueEdxJava/sources/MaxPairProduct.java51
1 files changed, 25 insertions, 26 deletions
diff --git a/AlgoDesignAndTechniqueEdxJava/sources/MaxPairProduct.java b/AlgoDesignAndTechniqueEdxJava/sources/MaxPairProduct.java
index dbe4ee6..fc7028c 100644
--- a/AlgoDesignAndTechniqueEdxJava/sources/MaxPairProduct.java
+++ b/AlgoDesignAndTechniqueEdxJava/sources/MaxPairProduct.java
@@ -16,13 +16,13 @@ public class MaxPairProduct {
public static void main(String[] args) {
FastScanner s = new FastScanner(System.in);
-
+
int n = s.nextInt();
MaxPairProduct mpp = new MaxPairProduct(n);
- for (int i = 0; i<n; i++) {
+ for (int i = 0; i < n; i++) {
mpp.newNumber(s.nextInt());
}
-
+
System.out.println(mpp.getProduct());
}
@@ -55,32 +55,31 @@ public class MaxPairProduct {
return (long) biggest * (long) bigger;
}
-}
-
-final class FastScanner {
- BufferedReader br;
- StringTokenizer st;
-
- FastScanner(InputStream stream) {
- try {
- br = new BufferedReader(new InputStreamReader(stream));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
+ static class FastScanner {
+ BufferedReader br;
+ StringTokenizer st;
- String next() {
- while (st == null || !st.hasMoreTokens()) {
+ FastScanner(InputStream stream) {
try {
- st = new StringTokenizer(br.readLine());
- } catch (IOException e) {
+ br = new BufferedReader(new InputStreamReader(stream));
+ } catch (Exception e) {
e.printStackTrace();
}
}
- return st.nextToken();
- }
-
- int nextInt() {
- return Integer.parseInt(next());
+
+ String next() {
+ while (st == null || !st.hasMoreTokens()) {
+ try {
+ st = new StringTokenizer(br.readLine());
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ return st.nextToken();
+ }
+
+ int nextInt() {
+ return Integer.parseInt(next());
+ }
}
-} \ No newline at end of file
+}