Notice
Recent Posts
Recent Comments
- Today
- Total
01-10 22:06
Tags
- Algorithm
- database
- ๋ฒจ๋งํฌ๋
- OOP
- ์๋ฐ
- MST
- dp
- spring
- ๋ค์ต์คํธ๋ผ
- ๋ฐ์ดํฐ๋ฒ ์ด์ค
- ๊ทธ๋ฆฌ๋
- ์์์ ๋ ฌ
- ์กธ์ ์ํ
- ํ๋ก๊ทธ๋๋จธ์ค
- array
- BFS
- ์๋ฐ์์ ์
- tree
- Graph
- ๋ฌธ๋ฒ
- pytorch
- ๋ฐฑ์๋
- ์๋ฃ๊ตฌ์กฐ
- PS
- ์ธํด
- java
- ๊ตฌํ
- ๋ฐฑ์ค
- leetcode
- CS
Link
Partially Committed
[ํ๋ก๊ทธ๋๋จธ์ค] ์์ ์ฐพ๊ธฐ ๋ณธ๋ฌธ
728x90
๋ฐ์ํ
SMALL
https://school.programmers.co.kr/learn/courses/30/lessons/12921
ํด๋น ๋ฌธ์ ๋ ํจ์จ์ฑ์ ๊น๊นํ๊ฒ ๋ณด๊ธฐ ๋๋ฌธ์ ์๋ผํ ์ค์ฒด๋ค์ค์ ์ฒด ์๊ณ ๋ฆฌ์ฆ์ ์ฌ์ฉํ์ง ์์ผ๋ฉด ๋๋ถ๋ถ TLE ์ฒ๋ฆฌ๋๋ค.
#include <bits/stdc++.h>
#define fastio cin.tie(0)->sync_with_stdio(0)
#define ll long long
using namespace std;
int solution(int n) {
int answer = 0;
vector<int> arr(n+1, 0);
fastio;
for (int i = 2; i <= n; i++)
{
if (arr[i] != 0) continue;
for (int j = i + i; j <= n; j += i) arr[j] = 1;
}
for (int i = 2; i <= n; i++)
if (arr[i] == 0) answer++;
return answer;
}
728x90
๋ฐ์ํ
LIST
'๐ฅ Algorithm || ๋ฌธ์ ํ์ด > PS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[2019 KAKAO BLIND RECRUITMENT] ์คํ์ฑํ ๋ฐฉ (0) | 2022.07.07 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค] ์ด์ํ ๋ฌธ์ ๋ง๋ค๊ธฐ (0) | 2022.07.06 |
[ํ๋ก๊ทธ๋๋จธ์ค] ๋ฌธ์์ด ๋ด ๋ง์๋๋ก ์ ๋ ฌํ๊ธฐ (0) | 2022.07.06 |
[ํ๋ก๊ทธ๋๋จธ์ค] ๊ฐ์ ์ซ์๋ ์ซ์ด (0) | 2022.07.06 |
[2018 KAKAO BLIND RECRUITMENT] (1์ฐจ) ๋คํธ ๊ฒ์ (0) | 2022.07.06 |
Comments