티스토리 뷰
https://www.acmicpc.net/problem/10093
문제를 제대로 읽고 맞는 자료형을 써야하는 문제였다. ( int -> long )
public class Q10093 {
static Scanner sc;
static long left;
static long right;
public static void main(String args[]) {
solve();
}
public static void solve() {
init();
answer();
}
public static void init() {
sc = new Scanner(System.in);
left = sc.nextLong();
right = sc.nextLong();
if(left > right) {
long temp = right;
right = left;
left = temp;
}
}
public static void answer() {
if(right == left) {
System.out.println(0);
return;
}
long twoNumberInCount = right - left - 1;
System.out.println(twoNumberInCount);
for(long num = left + 1; num < right; num++) {
System.out.print(num + " ");
}
}
}
'알고리즘 > 문제' 카테고리의 다른 글
실버III. 백준 1244 스위치 켜고 끄기 (0) | 2022.04.06 |
---|---|
실버V. 백준 1059 좋은구간 (0) | 2022.04.04 |
실버IV. 백준1676 팩토리얼 0의 개수 (0) | 2021.12.27 |
골드V. 백준 2688 줄어들지 않아 (0) | 2021.12.22 |
실버III. 백준 9095 1, 2 ,3 더하기 (0) | 2021.12.18 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- Co
- https://react.vlpt.us/basic/11-render-array.html
- ㄴ
- https://wikidocs.net/68
- https://jwprogramming.tistory.com/52
- https://subicura.com/2017/01/19/docker-guide-for-beginners-1.html
- https://velog.io/@juno7803/React%EA%B0%80-%ED%83%9C%EC%96%B4%EB%82%9C-%EB%B0%B0%EA%B2%BD
- https://react.vlpt.us/
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 | 29 | 30 | 31 |
글 보관함