자료구조 & 알고리즘/BOJ
[Java] 백준 5988번 문제
seungwook_TIL
2024. 7. 2. 20:56
문제설명
소스코드
import java.util.Scanner;
public class Boj_5988 {
public static void main(String[] args) throws Exception {
Scanner sc = new Scanner(System.in);
int N = sc.nextInt();
if(N != 0){
for (int i = 0; i < N; i++) {
String[] arr = sc.next().split("");
System.out.println(Integer.parseInt(arr[arr.length - 1]) % 2 == 1 ? "odd": "even");
}
}
}
}
설명
- 가장 주의해야 할 점은 K의 범위가 10^60이라는 점이다.
- 따라서 숫자로 처리하기 보다는 문자로 처리해야한다.