Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 브루트포스
- EventListener
- spring
- 백준알고리즘
- ELB
- EC2
- 다익스트라 알고리즘
- nodejs
- 백준
- java
- Spring Boot
- 서버구축
- sort
- AWS
- 알고리즘
- url parsing
- 자료구조
- 탐욕법
- BFS
- 토이프로젝트
- 스터디
- 동적프로그래밍
- 완전탐색
- mysql
- 정렬
- Router
- react
- 라우터
- 리액트
- Algorithm
Archives
- Today
- Total
공부하는 블로그
Baekjoon | Q.10817번 : 세 수 본문
10817번: 세 수
첫째 줄에 세 정수 A, B, C가 공백으로 구분되어 주어진다. (1 ≤ A, B, C ≤ 100)
www.acmicpc.net
세 정수 a b c중 두 번째로 큰 수를 찾는 문제이다.
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int c = sc.nextInt();
int second = 0;
if((a >= b && b >= c) || (c >= b && b >= a)) {
second = b;
}else if((a >= c && c >= b) || (b >= c && c >= a)) {
second = c;
}else if((b >= a && a >= c) || (c >= a && a >= b)) {
second = a;
}
System.out.println(second);
}
}
별 문제 없이 풀었다.
'알고리즘 공부' 카테고리의 다른 글
Baekjoon | Q.10871 - X보다 작은 수 (0) | 2019.12.18 |
---|---|
Baekjoon | Q.2439 - 별찍기 2 (0) | 2019.12.18 |
Baekjoon | Q.2884 - 알람 시계 (0) | 2019.12.18 |
Baekjoon | Q.10430 - 나머지 (0) | 2019.12.18 |
Baekjoon | Q.10171 - 고양이 (0) | 2019.12.18 |
Comments