UVA 787 - Maximum Sub-sequence Product UVA • Sep 1, 2020 Problem PDFSolution:package pkg787; import java.io.IOException; import java.math.BigInteger; import java.util.ArrayList; import java.util.Scanner; public class Main { private static String line; public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in); ArrayList a = new ArrayList(); BigInteger n; while (in.hasNext()) { n = in.nextBigInteger(); if (n.compareTo(BigInteger.valueOf(-999999))==0) { BigInteger result = a.get(0); BigInteger pro; for (int i = 0; i < a.size(); i ++) { pro =BigInteger.ONE; for(int j=i;j < a.size();j++) { pro = pro.multiply(a.get(j)); if (result.compareTo(pro) == -1) result = pro; } } a.clear(); System.out.println(result); } else { a.add(n); } } } } https://github.com/Shipu/OnlineJudgeProblemSolutionWithCPlusPlus/tree/master/uva/787/Main.java Tags UVA Competitive Programming Shipu Ahamed Recommended for you UVA UVA 913 - Joana and the Odd Numbers 4 years ago • 1 min read UVA UVA 871 - Counting Cells in a Blob 4 years ago • 3 min read UVA UVA 866 - Intersecting Line Segments 4 years ago • 3 min read