반응형
https://www.acmicpc.net/problem/9251
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
32
|
#include<iostream>
#include<string>
#include<algorithm>
using namespace std;
string s1;
string s2;
int dp[1002][1002];
int main(){
cin>>s1;
cin>>s2;
for(int i=0;i<len1;i++){
for(int j=0;j<len2;j++){
if(s1[i] == s2[j]){
dp[i+1][j+1] = dp[i][j]+1;
}else{
dp[i+1][j+1] = max(dp[i][j+1],dp[i+1][j]);
}
}
}
cout<<dp[len1][len2]<<"\n";
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
|
반응형
'ProgramSoliving' 카테고리의 다른 글
백준 : 14890 (0) | 2020.01.12 |
---|---|
백준 : 16234 * (0) | 2020.01.11 |
백준 : 3055 (0) | 2020.01.01 |
백준 : 2468 (0) | 2020.01.01 |
백준 : 14888 (0) | 2019.12.25 |