Skip to content

Commit

Permalink
Merge pull request #9 from AlgoLeadMe/2-suhyun113
Browse files Browse the repository at this point in the history
2-suhyun113
  • Loading branch information
suhyun113 authored Apr 2, 2024
2 parents 570524d + 585934d commit c2875e7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion suhyun113/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
| μ°¨μ‹œ | λ‚ μ§œ | λ¬Έμ œμœ ν˜• | 링크 | 풀이 |
|:----:|:---------:|:----:|:-----:|:----:|
| 1μ°¨μ‹œ | 2024.03.25 | 그리디 | [체윑볡](https://school.programmers.co.kr/learn/courses/30/lessons/42862) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/2) |
---
| 2μ°¨μ‹œ | 2024.03.29 | μˆ˜ν•™ | [μ†Œμˆ˜ & νŒ°λ¦°λ“œλ‘¬](https://www.acmicpc.net/problem/1747) | [#1](https://github.com/AlgoLeadMe/AlgoLeadMe-10/pull/9) |
22 changes: 22 additions & 0 deletions suhyun113/μˆ˜ν•™/2-suhyun113.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# νŒ°λ¦°λ“œλ‘¬ 수
def is_palindrome(num):
return str(num) == str(num)[::-1]

# μ†Œμˆ˜ μ°ΎκΈ°
def is_prime_num(n):
if n < 2:
return False # 1은 μ†Œμˆ˜κ°€ μ•„λ‹˜
for i in range(2, int(n**0.5) + 1):
if n % i == 0:
return False
return True

N = int(input()) # μ–΄λ–€ 수 N
# output은 N보닀 ν¬κ±°λ‚˜ κ°™μœΌλ―€λ‘œ N으둜 μ΄ˆκΈ°ν™”
result = N # ν˜„μž¬

while True: # N보닀 ν¬κ±°λ‚˜ 같은 수(항상)
if is_prime_num(result) and is_palindrome(result): # μ†Œμˆ˜μ΄λ©΄μ„œ νŒ°λ¦°λ“œλ‘¬μΈ 수
print(result)
break
result += 1

0 comments on commit c2875e7

Please sign in to comment.