20250615 baekjoon python
This commit is contained in:
parent
50605536e2
commit
b90a072488
8
code_study/Baekjoon/python/11653.py
Normal file
8
code_study/Baekjoon/python/11653.py
Normal file
@ -0,0 +1,8 @@
|
||||
N = int(input())
|
||||
n=2
|
||||
while(N>1) :
|
||||
if N%n==0 :
|
||||
print(n)
|
||||
N //= n
|
||||
else :
|
||||
n += 1
|
||||
14
code_study/Baekjoon/python/1978.py
Normal file
14
code_study/Baekjoon/python/1978.py
Normal file
@ -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)
|
||||
9
code_study/Baekjoon/python/2501.py
Normal file
9
code_study/Baekjoon/python/2501.py
Normal file
@ -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)
|
||||
17
code_study/Baekjoon/python/2581.py
Normal file
17
code_study/Baekjoon/python/2581.py
Normal file
@ -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}')
|
||||
7
code_study/Baekjoon/python/5086.py
Normal file
7
code_study/Baekjoon/python/5086.py
Normal file
@ -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")
|
||||
15
code_study/Baekjoon/python/9506.py
Normal file
15
code_study/Baekjoon/python/9506.py
Normal file
@ -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.")
|
||||
Loading…
x
Reference in New Issue
Block a user