백준 10817번 세 수
package algo;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Scanner;
public class BJ10817 {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
String[] line = bf.readLine().split(" ");
String a = line[0];
String b = line[1];
String c = line[2];
int a1 = Integer.parseInt(a);
int b1 = Integer.parseInt(b);
int c1 = Integer.parseInt(c);
if(a1>=b1 && a1<=c1 || a1<=b1 && a1>=c1) {
System.out.println(a1);
}else if(b1>=a1 && b1<=c1 || b1<=a1 && b1>=c1) {
System.out.println(b1);
}else {
System.out.println(c1);
}
}
}
-------------------------------------------------------
또 복잡하게 푼 듯..
그냥 입력 3개 받아서 해도 된다..
Scanner sc = new Scanner(System.in);
int a1 = sc.nextInt();
int b1 = sc.nextInt();
int c1 = sc.nextInt();
이렇게 풀자..