Notice
Recent Posts
Recent Comments
Link
์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
Tags
- ํ๋ก ํธ์๋
- ๊ฐ๋ฐ
- ์ฝ๋ฉํ ์คํธ
- Python
- javascript
- ์๊ณ ๋ฆฌ์ฆ
- ๋ฐฑ์ค
- ํ๋ก๊ทธ๋๋จธ์ค
- node.js
- ํ ์ดํ๋ก์ ํธ
- react
- Til
- ๋ ธ๋ง๋์ฝ๋
- ๊ทธ๋ฆฌ๋
- ํ๋ก์ ํธ
- ํฌ๋กค๋ง
- error
- ํ์ด์ฌ
- ๋๋ฆผ์ฝ๋ฉ
- ์ฝ๋ฉ
- JS
- ์ฝ๋ฉ์ ํ
- HTML
- KDT
- fe
- heapq
- mongodb
- ๋ชจ๊ฐ์ฝ
- ๊ตญ๋น์ง์
- CSS
Archives
- Today
- Total
๐ฑ → ๐ณ
[๋ฐฑ์ค] 4948๋ฒ: ๋ฒ ๋ฅดํธ๋ ๊ณต์ค ๋ณธ๋ฌธ
728x90
https://www.acmicpc.net/problem/4948
์ฒ์ ์ฝ๋:
while(1):
a=int(input())
if a ==0:
break
cnt=0
for i in range(a+1,2*a+1):
if i == 1:
continue
for j in range(2,int(i**0.5)+1):
if i % j == 0:
break
else:
cnt+=1
print(cnt)
๊ฐ ํ
์คํธ ์ผ์ด์ค๋ง๋ค ๊ณ์ ์์๋ฅผ ๊ณ์ฐํ๋๊น ์๊ฐ ์ด๊ณผ ๋ฐ์
์ ๋ต ์ฝ๋:
sosu =[]
for i in range(2,246913):
cnt = 0
for j in range(2, int(i**0.5)+1):
if i % j ==0:
cnt += 1
break
if cnt == 0:
sosu.append(i)
while(1):
a = int(input())
count = 0
if a == 0:
break
for i in sosu:
if a < i <= 2*a:
count +=1
print(count)
๋ฌธ์ ์์ ์ฃผ์ด์ง ๋ฒ์ ๋ด์์ ์์๋ฅผ ๋จผ์ ๋ชจ๋ ๊ตฌํ๊ณ ์์ํ๋ ๋ฐฉ๋ฒ์ผ๋ก ์๊ฐ ์ด๊ณผ ํด๊ฒฐ
728x90
'Algorithms' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[๋ฐฑ์ค] 2750, 2751 - ์ ์ ๋ ฌํ๊ธฐ 1,2 python (0) | 2022.10.02 |
---|---|
[๋ฐฑ์ค] 9020๋ฒ: ๊ณจ๋๋ฐํ์ ์ถ์ธก (0) | 2022.07.30 |
[ํ๋ก๊ทธ๋๋จธ์ค] ์๋ฐ์๋ฐ์๋ฐ์๋ฐ์๋ฐ์? JavaScript (0) | 2022.07.22 |
[๋ฐฑ์ค] 1929๋ฒ: ์์ ๊ตฌํ๊ธฐ python (0) | 2022.07.22 |
[๋ฐฑ์ค] 11653๋ฒ: ์์ธ์๋ถํด python (0) | 2022.07.20 |