File tree 2 files changed +38
-0
lines changed
2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ # [ Bronze II] 수 뒤집기 - 3062
2
+
3
+ [ 문제 링크] ( https://www.acmicpc.net/problem/3062 )
4
+
5
+ ### 성능 요약
6
+
7
+ 메모리: 32412 KB, 시간: 32 ms
8
+
9
+ ### 분류
10
+
11
+ 사칙연산, 구현, 수학, 문자열
12
+
13
+ ### 제출 일자
14
+
15
+ 2024년 12월 28일 20:10:37
16
+
17
+ ### 문제 설명
18
+
19
+ <p >수 124를 뒤집으면 421이 되고 이 두 수를 합하면 545가 된다. 124와 같이 원래 수와 뒤집은 수를 합한 수가 좌우 대칭이 되는지 테스트 하는 프로그램을 작성하시오.</p >
20
+
21
+ ### 입력
22
+
23
+ <p >입력의 첫 줄에는 테스트 케이스의 개수 T가 주어진다. 각 테스트 케이스는 한 줄에 하나의 정수 N(10 ≤ N ≤ 100000)이 주어진다.</p >
24
+
25
+ ### 출력
26
+
27
+ <p >각 테스트 케이스에 대해서 원래 수와 뒤집은 수를 합한 수가 좌우 대칭이 되면 YES를 아니면 NO를 한 줄에 하나씩 출력한다.</p >
28
+
Original file line number Diff line number Diff line change
1
+ import sys
2
+
3
+ t = int (sys .stdin .readline ().strip ())
4
+
5
+ for _ in range (t ):
6
+ num1 = sys .stdin .readline ().strip ()
7
+ num2 = '' .join (reversed (num1 ))
8
+ res = str (int (num1 )+ int (num2 ))
9
+
10
+ print ("YES" if res == res [::- 1 ] else "NO" )
You can’t perform that action at this time.
0 commit comments