You are viewing a single comment's thread. Return to all comments →
what do you think about this solution in java:
public static void main(String[] args) { Scanner in = new Scanner(System.in); long a = in.nextLong(); long b = in.nextLong(); long c = in.nextLong(); long d = in.nextLong(); long e = in.nextLong(); SortedSet<Long> sortedSet = new TreeSet(); sortedSet.add(b + c + d + e); sortedSet.add(a + c + d + e); sortedSet.add(a + b + d + e); sortedSet.add(a + b + c + e); sortedSet.add(a + b + c + d); System.out.println(sortedSet.first() + " " + sortedSet.last()); }
Seems like cookies are disabled on this browser, please enable them to open this website
Mini-Max Sum
You are viewing a single comment's thread. Return to all comments →
what do you think about this solution in java: