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
- javascript
- ํ๋ก๊ทธ๋๋จธ์ค
- ์ฝ๋ฉ
- Python
- ๋ ธ๋ง๋์ฝ๋
- KDT
- ๋ฐฑ์ค
- heapq
- react
- ๋๋ฆผ์ฝ๋ฉ
- node.js
- ์ฝ๋ฉํ ์คํธ
- ํ๋ก ํธ์๋
- ์ฝ๋ฉ์ ํ
- ํ์ด์ฌ
- error
- ํฌ๋กค๋ง
- ์๊ณ ๋ฆฌ์ฆ
- ๊ฐ๋ฐ
- ๊ตญ๋น์ง์
- ๊ทธ๋ฆฌ๋
- JS
- fe
- CSS
- mongodb
- ํ ์ดํ๋ก์ ํธ
- ํ๋ก์ ํธ
- ๋ชจ๊ฐ์ฝ
- HTML
- Til
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 |