반응형
import java.util.List;
import java.util.Scanner;
import java.util.Vector;
import java.util.Arrays;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
int[] point = new int[4];
for(int i = 0; i < 4; i++) {
point[i] = sc.nextInt();
}
int smallPnt_1 = point[0] < point[1] ? point[0] : point[1];
int largePnt_1 = point[0] > point[1] ? point[0] : point[1];
int reverse_distance_1 = 100 - (largePnt_1 - smallPnt_1);
Boolean isIn = false;
Boolean isOut = false;
for(int i = 2; i <= 3; i++) {
if(point[i] > smallPnt_1 && point[i] < largePnt_1) isIn = true;
if(Check(largePnt_1, reverse_distance_1, point[i])) isOut = true;
}
// System.out.println(isIn);
// System.out.println(isOut);
if(isIn && isOut) {
System.out.println("cross");
}
else {
System.out.println("not cross");
}
}
static Boolean Check(int start, int end, int point) {
for(int i = 0; i <= end; i++) {
int num = start + i;
if(num > 100) {
num = num - 100;
}
if(num == point) {
return true;
}
}
return false;
}
}
반응형
'프로그래밍 > 코드업 일기' 카테고리의 다른 글
코드업(Codeup) 2634 : 거스름돈 II (0) | 2023.08.10 |
---|---|
코드업(Codeup) 2631 : 보물 찾기 (0) | 2023.08.10 |
코드업(Codeup) 1920 : (재귀함수) 2진수 변환 (0) | 2023.08.10 |
코드업(Codeup) 1916 : (재귀함수) 피보나치 수열 (Large) (0) | 2023.08.10 |
코드업(Codeup) 1805 : 입체기동장치 생산공장 (0) | 2023.08.10 |