Skip to content

Instantly share code, notes, and snippets.

@PreSoichiSumi
Created April 26, 2016 08:05
Show Gist options
  • Save PreSoichiSumi/5bd9065ee7c5fa6d451fa6f1d820cc7d to your computer and use it in GitHub Desktop.
Save PreSoichiSumi/5bd9065ee7c5fa6d451fa6f1d820cc7d to your computer and use it in GitHub Desktop.
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Scanner;
public class Main {
public static int[][] maze =new int [100][];
public static int[][] dist =new int [100][];
public static int[][] dir ={{-1,0},{1,0},{0,-1},{0,1}};
public static void main(String[] args) {
Scanner sc=new Scanner(System.in);
List<Integer> list=new ArrayList<Integer>();
List<Integer> res=new ArrayList<>();
for(int i=0;i<5;i++){
list.add(sc.nextInt());
}
for(int i=0;i<5;i++){
for(int j=i+1;j<5;j++){
for(int k=j+1;k<5;k++){
res.add(list.get(i)+list.get(j)+list.get(k));
}
}
}
Collections.sort(res);
Collections.reverse(res);
// System.out.println(res);
System.out.println(res.get(2));
sc.close();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment