From 1300f4215111882a2571a3eb1ec71b020f2fa63c Mon Sep 17 00:00:00 2001 From: songyc macbook Date: Sat, 14 Jun 2025 18:07:24 +0900 Subject: [PATCH] 20250614 baekjoon python --- code_study/Baekjoon/python/11653.py | 8 ++++++++ code_study/Baekjoon/python/1978.py | 14 ++++++++++++++ code_study/Baekjoon/python/2501.py | 9 +++++++++ code_study/Baekjoon/python/2581.py | 17 +++++++++++++++++ code_study/Baekjoon/python/5086.py | 7 +++++++ code_study/Baekjoon/python/9506.py | 15 +++++++++++++++ 6 files changed, 70 insertions(+) create mode 100644 code_study/Baekjoon/python/11653.py create mode 100644 code_study/Baekjoon/python/1978.py create mode 100644 code_study/Baekjoon/python/2501.py create mode 100644 code_study/Baekjoon/python/2581.py create mode 100644 code_study/Baekjoon/python/5086.py create mode 100644 code_study/Baekjoon/python/9506.py diff --git a/code_study/Baekjoon/python/11653.py b/code_study/Baekjoon/python/11653.py new file mode 100644 index 0000000..0928ab7 --- /dev/null +++ b/code_study/Baekjoon/python/11653.py @@ -0,0 +1,8 @@ +N = int(input()) +n=2 +while(N>1) : + if N%n==0 : + print(n) + N //= n + else : + n += 1 \ No newline at end of file diff --git a/code_study/Baekjoon/python/1978.py b/code_study/Baekjoon/python/1978.py new file mode 100644 index 0000000..ba0fe87 --- /dev/null +++ b/code_study/Baekjoon/python/1978.py @@ -0,0 +1,14 @@ +n = int(input()) +num = list(map(int, input().split())) +count = 0 + +for t in num : + if t==1 : continue + isPrime = True + for i in range(2,int(t**0.5)+1) : + if t%i==0 : + isPrime = False + break + if isPrime : count+=1 + +print(count) \ No newline at end of file diff --git a/code_study/Baekjoon/python/2501.py b/code_study/Baekjoon/python/2501.py new file mode 100644 index 0000000..a2ee6a1 --- /dev/null +++ b/code_study/Baekjoon/python/2501.py @@ -0,0 +1,9 @@ +n, k = map(int, input().split()) +for i in range(1,n+1) : + if n%i==0 : + k-=1 + if k==0 : + print(i) + break + +if(k!=0) : print(0) \ No newline at end of file diff --git a/code_study/Baekjoon/python/2581.py b/code_study/Baekjoon/python/2581.py new file mode 100644 index 0000000..4b0b0cd --- /dev/null +++ b/code_study/Baekjoon/python/2581.py @@ -0,0 +1,17 @@ +total = 0 +minPrime = 0 +for n in range(int(input()), int(input())+1) : + if n==1 : continue + isPrime = True + for i in range(2, int(n**0.5)+1) : + if n%i==0 : + isPrime = False + break + + if isPrime : + if minPrime==0 : minPrime = n + total += n + +if total==0 : print(-1) +else : + print(f'{total}\n{minPrime}') \ No newline at end of file diff --git a/code_study/Baekjoon/python/5086.py b/code_study/Baekjoon/python/5086.py new file mode 100644 index 0000000..afe25e9 --- /dev/null +++ b/code_study/Baekjoon/python/5086.py @@ -0,0 +1,7 @@ +while(True) : + a, b = map(int, input().split()) + if a==0 and b==0 : break + + if a%b==0 : print("multiple") + elif b%a==0 : print("factor") + else : print("neither") \ No newline at end of file diff --git a/code_study/Baekjoon/python/9506.py b/code_study/Baekjoon/python/9506.py new file mode 100644 index 0000000..52bb42a --- /dev/null +++ b/code_study/Baekjoon/python/9506.py @@ -0,0 +1,15 @@ +while(True) : + n = int(input()) + if n==-1 : break + + sum = 0 + res = [] + for i in range(1,int(n/2) + 1) : + if n%i==0 : + res.append(str(i)) + sum += i + + if sum==n : + print(n,'='," + ".join(res)) + else : + print(n,"is NOT perfect.") \ No newline at end of file