/
3062.java
40 lines (33 loc) · 952 Bytes
/
3062.java
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
32
33
34
35
36
37
38
39
40
/**
* 3062. 수 뒤집기
*
* 작성자: Raccoon Dog
* 언어: Java 8
* 사용 메모리: 14,320 KB
* 소요 시간: 124 ms
* 해결 날짜: 2020년 9월 21일
*/
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int testCase = scanner.nextInt();
scanner.nextLine();
String[] str = new String[testCase];
for(int i = 0; i < testCase; i++) {
str[i] = scanner.nextLine();
}
scanner.close();
for(int i = 0; i < testCase; i++) {
int firstInt = Integer.parseInt(str[i]);
int secondInt = Integer.parseInt(new StringBuffer(str[i]).reverse().toString());
String resultStr = Integer.toString(firstInt + secondInt);
StringBuffer resultStrReverse = new StringBuffer(resultStr).reverse();
if (resultStr.contentEquals(resultStrReverse)) {
System.out.println("YES");
} else {
System.out.println("NO");
}
}
}
}