1456은 굉장히 어렵습니다. 어떻게 저걸 Python으로 해먹죠?
This commit is contained in:
1
zeta_python/completed/1427.py
Normal file
1
zeta_python/completed/1427.py
Normal file
@@ -0,0 +1 @@
|
||||
for i in sorted(map(int, input()))[::-1]:print(i, end='')
|
||||
28
zeta_python/completed/1456.py
Normal file
28
zeta_python/completed/1456.py
Normal file
@@ -0,0 +1,28 @@
|
||||
A, B = map(int, input().split())
|
||||
P = [2]
|
||||
cnt = 0
|
||||
t = 4
|
||||
while B >= t:
|
||||
if A <= t <= B:
|
||||
cnt += 1
|
||||
t *= 2
|
||||
for i in range(3, int(B ** (1 / 2)) + 1, 2):
|
||||
for p in P:
|
||||
if i % p == 0:
|
||||
break
|
||||
elif i < p ** 2:
|
||||
P.append(i)
|
||||
t = i * i
|
||||
while B >= t:
|
||||
if A <= t <= B:
|
||||
cnt += 1
|
||||
t *= i
|
||||
break
|
||||
else:
|
||||
P.append(i)
|
||||
t = i * i
|
||||
while B >= t:
|
||||
if A <= t <= B:
|
||||
cnt += 1
|
||||
t *= i
|
||||
print(cnt) # 매우 빨라지고 싶은 에라토스테네스 내장형++
|
||||
30
zeta_python/completed/2108.py
Normal file
30
zeta_python/completed/2108.py
Normal file
@@ -0,0 +1,30 @@
|
||||
import sys
|
||||
N = int(sys.stdin.readline())
|
||||
C = [0] * 8001
|
||||
I = []
|
||||
for i in range(N):
|
||||
t = int(sys.stdin.readline())
|
||||
C[t + 4000] += 1
|
||||
I.append(t)
|
||||
print(round(sum(I)/N))
|
||||
I.sort()
|
||||
print(I[N//2])
|
||||
M, m = I[-1], I[0]
|
||||
|
||||
mor = 0
|
||||
ner = 0
|
||||
cnd = 0
|
||||
for i, c in enumerate(C):
|
||||
if c > mor:
|
||||
mor = c
|
||||
cnd = 0
|
||||
ner = i
|
||||
elif c == mor:
|
||||
if cnd == 0:
|
||||
cnd = 1
|
||||
ner = i
|
||||
elif cnd == 1:
|
||||
pass
|
||||
print(ner - 4000)
|
||||
|
||||
print(abs(M-m))
|
||||
Reference in New Issue
Block a user