Algorithm(218)
-
[BOJ] 2293번 : 동전 1
1. problem : https://www.acmicpc.net/problem/2293 2. solution 1 :#include using namespace std;int n, k; int a[105];int d[10005]; int main(void) { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> k; for (int i = 0; i > a[i]; d[0] = 1; for (int i = 0; i source code 출처 : https://github.com/encrypted-def/basic-algo-lecture/blob/master/0x10/solutions/2293.cpp basic-algo-lecture/0x10/solutions/22..
2024.09.30 -
[BOJ] 2960번 : 에라토스테네스의 체
1. problem : https://www.acmicpc.net/problem/2960 2. solution 1 :#include using namespace std;int n, k;int board[1005]; vector ans;int main(void) { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> k; for (int i = 2; i 에라토스테네스의 체를 이용해 풀었다. 좀 더 효율적인 방법이 있을 것 같다. 3. solution 2 :// Authored by : jihwan0123// Co-authored by : -// http://boj.kr/c980507acdc34d5ea79e397129f664c5#include using namespa..
2024.09.30 -
[BOJ] 11057번 : 오르막 수
1. problem : https://www.acmicpc.net/problem/11057 2. solution 1 :#include using namespace std;int n; int d[1003][10];int main(void) { ios::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 1; i source code 출처 : https://github.com/encrypted-def/basic-algo-lecture/blob/master/0x10/solutions/11057.cpp basic-algo-lecture/0x10/solutions/11057.cpp at master · encrypted-def/basic-algo-lecture바..
2024.09.29 -
[BOJ] 9465번 : 스티커
1. problem : https://www.acmicpc.net/problem/9465 2. solution 1 : #include using namespace std;const int val = 100005;int a[3][val];int main(void) { ios::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { int n; int d[2][3][2] = { 0 }; cin >> n; for (int i = 1; i > a[i][j]; } for (int i = 1; i dp를 이용해 풀었다. 따라서, 세 가지 스텝을 따른다. 1. 테이블을 정의한다. d [i][j][k] --> i번째 열, j번째 행을 k== ..
2024.09.27 -
[BOJ] 4796번 : 캠핑
1. problem : https://www.acmicpc.net/problem/4796 2. solution 1 :#include using namespace std;int main(void) { ios::sync_with_stdio(0); cin.tie(0); int i = 0; while (true) { i++; long long l, p, v; cin >> l >> p >> v; if (l == 0 && p == 0 && v == 0) return 0; long long ans = 0; long long div = v / p; ans += div * l; if (v - div * p > l) ans += l; else ans += v - div * p; cout p를 이용해 몫을..
2024.09.26 -
[BOJ] 15894번 : 수학은 체육과목 입니다
1. problem : https://www.acmicpc.net/problem/15894 2. solution 1 :#include using namespace std;long long n;int main(void) { ios::sync_with_stdio(0); cin.tie(0); cin >> n; cout 옆면을 옆으로 밀어버리고, 밑면은 밑으로 밀어버리고, 윗면은 위로 밀어버리면, 정사각형이라고 생각할 수 있다. 설명참조 : https://github.com/encrypted-def/basic-algo-lecture/blob/master/0x12/solutions/15894.cpp basic-algo-lecture/0x12/solutions/15894.cpp at master · encryp..
2024.09.26