์ผ | ์ | ํ | ์ | ๋ชฉ | ๊ธ | ํ |
---|---|---|---|---|---|---|
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 | 31 |
- react
- Kaggle
- ๋ฐ์ดํฐ๋ถ์
- ๋ฐฑ์ค
- Titanic
- ๋ฅ๋ฌ๋
- ์ ํ๋์ํ
- Git
- native
- ๋ค์ดํฐ๋ธ
- ์๋ฒ ๋ฉ
- cs231n
- ํ๊ตญ์ด์๋ฒ ๋ฉ
- nlp
- ๋ถ์
- ๊ฒฐ์ ํธ๋ฆฌ
- ์๋๋ก์ด๋์คํ๋์ค
- ์๊ณ ๋ฆฌ์ฆ
- ๋ฆฌ์กํธ
- c++
- ๋์
- ๋ฐ์ดํฐ
- ์ํ์ฝ๋ฉ
- AI
- ํ์ดํ๋
- linearalgebra
- ๋จธ์ ๋ฌ๋
- ๋ฐ์ดํฐ์๊ฐํ
- ์ธํ๋ฐ
- ๊นํ
- Today
- Total
๋ชฉ๋กComputer ๐ป/์๊ณ ๋ฆฌ์ฆ (7)
yeon's ๐ฉ๐ป๐ป
๋ถํ ์ ๋ณต (Divide & Conquer) : ์ฃผ์ด์ง ๋ฌธ์ ๋ฅผ ๋ ์ด์์ ๋ถ๋ถ ๋ฌธ์ ๋ก ๋๋ ๋ค ๊ฐ ๋ฌธ์ ์ ๋ํ ๋ต์ ์ฌ๊ท ํธ์ถ์ ์ด์ฉํด ๊ณ์ฐํ๊ณ , ๊ฐ ๋ถ๋ถ ๋ฌธ์ ์ ๋ต์ผ๋ก๋ถํฐ ์ ์ฒด ๋ฌธ์ ์ ๋ต์ ๊ณ์ฐํด ๋ * ์ผ๋ฐ์ ์ธ ์ฌ๊ท ํธ์ถ๊ณผ ๋ค๋ฅธ ์ ์ ๋ฌธ์ ๋ฅผ ๊ฑฐ์ ๊ฐ์ ํฌ๊ธฐ์ ๋ถ๋ถ ๋ฌธ์ ๋ก ๋๋๋ค๋ ๊ฒ! 1. ๋ฌธ์ ๋ฅผ ๋ ์์ ๋ฌธ์ ๋ก ๋ถํ ํ๋ ๊ณผ์ (divide) 2. ๊ฐ ๋ฌธ์ ์ ๋ํด ๊ตฌํ ๋ต์ ์๋ ๋ฌธ์ ์ ๋ํ ๋ต์ผ๋ก ๋ณํฉํ๋ ๊ณผ์ (merge) 3. ๋ ์ด์ ๋ต์ ๋ถํ ํ์ง ์๊ณ ๊ณง์ฅ ํ ์ ์๋ ๋งค์ฐ ์์ ๋ฌธ์ (base case) * 1๋ถํฐ n๊น์ง์ ํฉ์ ๊ตฌํ๋ ๋ถํ ์ ๋ณต ์๊ณ ๋ฆฌ์ฆ: 1 + 2 + ... + n fastSum() = 1 + 2 + ... + n = (1 + 2 + ... + n/2) + ((n/2 +..

ํํ์ฌ๋ณํ์ ๊ธฐ๋ณธ ์ฑ์ง๋ง ์๊ณ ์๋ค๋ฉด ์ด๋ ต์ง ์์๋ ๋ฌธ์ ์ธ ์ ์ด ๋์์์ผ๋ฏ๋ก ์ธ ๋ณ์ด ๋์จ๋ค. ์ธ ๋ณ์ ๊ธธ์ด ์ค ์ต๋๊ฐ๊ณผ ์ต์๊ฐ์ ๊ตฌํ๋ฉด ๋ ! #include #include using namespace std; double Distance(int p1, int p2, int q1, int q2) { double distance; distance = sqrt(pow(p1-q1, 2) + pow(p2-q2, 2)); return distance; } int main() { int xa, ya, xb, yb, xc, yc, xd, yd; cin >> xa >> ya >> xb >> yb >> xc >> yc; double l1, l2, l3; double max_dist, min_dist; l1 = 2 ..

https://www.acmicpc.net/problem/1037 1037๋ฒ: ์ฝ์ ์ฒซ์งธ ์ค์ N์ ์ง์ง ์ฝ์์ ๊ฐ์๊ฐ ์ฃผ์ด์ง๋ค. ์ด ๊ฐ์๋ 50๋ณด๋ค ์๊ฑฐ๋ ๊ฐ์ ์์ฐ์์ด๋ค. ๋์งธ ์ค์๋ N์ ์ง์ง ์ฝ์๊ฐ ์ฃผ์ด์ง๋ค. 1,000,000๋ณด๋ค ์๊ฑฐ๋ ๊ฐ๊ณ , 2๋ณด๋ค ํฌ๊ฑฐ๋ ๊ฐ์ ์์ฐ์์ด๊ณ , ์ค๋ณต๋ www.acmicpc.net #include #include using namespace std; int main() { int N; cin >> N; int *divisor = new int[N]; for (int i=0; i> divisor[i]; } sort(divisor, divisor+N); cout

https://www.acmicpc.net/problem/1010 1010๋ฒ: ๋ค๋ฆฌ ๋๊ธฐ ์ ๋ ฅ์ ์ฒซ ์ค์๋ ํ ์คํธ ์ผ์ด์ค์ ๊ฐ์ T๊ฐ ์ฃผ์ด์ง๋ค. ๊ทธ ๋ค์ ์ค๋ถํฐ ๊ฐ๊ฐ์ ํ ์คํธ์ผ์ด์ค์ ๋ํด ๊ฐ์ ์์ชฝ๊ณผ ๋์ชฝ์ ์๋ ์ฌ์ดํธ์ ๊ฐ์ ์ ์ N, M (0 < N ≤ M < 30)์ด ์ฃผ์ด์ง๋ค. www.acmicpc.net ์ด ๋ฌธ์ ๋ ๋ณด์๋ง์ ์กฐํฉ ๋ฌธ์ ๋ผ๋๊ฒ ์ฝํ์ ธ ํฌ๊ฒ ์ด๋ ต์ง ์์๋ค. ํ์ง๋ง ํจ์๋ฅผ ๋ง๋๋๋ฐ ์๊พธ ์ค๋ฅ๊ฐ ๋ด์์ .. #include #include #include using namespace std; // nCr = n-1Cr-1 + n-1Cr int T, N, M; long long dp[35][35]; long long combination(int n, int r) { if ((n==r) || ..