8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ba3b2fb commit 5368bfdCopy full SHA for 5368bfd
Appendix E/9251.cpp
@@ -0,0 +1,25 @@
1
+// http://boj.kr/cf49db3b3f394eb192a482da5f7a8f84
2
+#include <bits/stdc++.h>
3
+using namespace std;
4
+
5
+string a, b;
6
+int n, m;
7
+int d[1005][1005];
8
9
+int main() {
10
+ ios::sync_with_stdio(0);
11
+ cin.tie(0);
12
13
+ cin >> a >> b;
14
+ n = a.size();
15
+ m = b.size();
16
17
+ for(int i = 1; i <= n; i++){
18
+ for(int j = 1; j <= m; j++){
19
+ if(a[i-1] == b[j-1])
20
+ d[i][j] = d[i-1][j-1] + 1;
21
+ d[i][j] = max({d[i][j], d[i-1][j], d[i][j-1]});
22
+ }
23
24
+ cout << d[n][m];
25
+}
0 commit comments