Algorithm(218)
-
[BOJ] 9655번 : 돌 게임
1. problem : https://www.acmicpc.net/problem/9655 2. solution 1 :#include using namespace std;int n; string d[1005];int main(void) { ios::sync_with_stdio(0); cin.tie(0); for (int i = 1; i > n; cout
2024.09.05 -
[BOJ] 10942번 : 팰린드롬?
1. problem : https://www.acmicpc.net/problem/10942 2. solution1 :#include using namespace std;int n; int nums[2005]; int d[2005][2005]; // i부터 j까지의 palindrome 여부 기록; int main(void) { ios::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 1; i > nums[i]; d[i][i] = 1; if (nums[i] == nums[i - 1]) d[i - 1][i] = 1; } for (int gap = 2; gap > t; while (t--) { int s, e; cin >> s >> e; cout s..
2024.09.05 -
[BOJ] 1915번 : 가장 큰 정사각형
1. problem : https://www.acmicpc.net/problem/1915 2 .solution1 :#include using namespace std; int n, m; int board[1005][1005], d[1005][1005]; int main(void) { ios::sync_with_stdio(0); cin.tie(0); cin >> n >> m; for (int i = 1; i > s; for (int j = 1; j source code 출처 : https://github.com/encrypted-def/basic-algo-lecture/blob/master/0x10/solutions/1915.cpp basic-algo-lecture/0x10/solutions/191..
2024.09.04 -
[BOJ] 9084번 : 동전
1. problem : https://www.acmicpc.net/problem/9084 2. solution1 :#include using namespace std;int n, m; int a[10005];int d[10005];int main(void) { ios::sync_with_stdio(0); cin.tie(0); int t; cin >> t; while (t--) { cin >> n; for (int i = 0; i > a[i]; fill(d, d + 10005, 0); d[0] = 1; cin >> m; for (int i = 0; i source code 출처 : https://github.com/encrypted-def/basic-algo-lecture/blob/m..
2024.09.04 -
[BOJ] 1699번 : 제곱수의 합
1. problem : https://www.acmicpc.net/problem/1699 2. solution 1 :#include using namespace std;int n;int d[100005];int main(void) { ios::sync_with_stdio(0); cin.tie(0); cin >> n; for (int i = 1; i soure code 출처 : https://github.com/encrypted-def/basic-algo-lecture/blob/master/0x10/solutions/1699.cpp basic-algo-lecture/0x10/solutions/1699.cpp at master · encrypted-def/basic-algo-lectu..
2024.09.03 -
[BOJ] 9251번 : LCS
1. problem : https://www.acmicpc.net/problem/9251 2. solution 1 :// Authored by : yongjunleeme// Co-authored by : -// http://boj.kr/33e1192d073d42e4853b36bc1cfd597d#include using namespace std;int d[1005][1005];// d[i][j] = a의 i-1번째 글자와 b의 j-1번째 글자까지 최장 공통 부분수열// 최장 공통부분 수열을 보존하기 위해 2중 for문을 사용// d[i][j] --> if(a[i-1] == b[j-1])이면 d[i-1][j-1] + 1// d[i][j] --> if(a[i-1] != b[j-1])이면 max(d[i-1][j..
2024.09.03