✎
±à³Ì¿ª·¢Íø
Ê×Ò³
CÓïÑÔ
C++
ÃæÊÔ
Linux
º¯Êý
Windows
Êý¾Ý¿â
ÏÂÔØ
ËÑË÷
µ±Ç°Î»Öãº
Ê×Ò³
->
»ù´¡
->
c++±à³Ì»ù´¡
UVA - 111 - History Grading £¨LCS£©(¶þ)
2015-07-20 17:10:31
¡¤
×÷Õß:
¡¤
ä¯ÀÀ:
10
±êÇ©:
UVA
111
History
Grading
LCS
-1] = i; } while(cin >> t) { tmp[t-1] = 0; for(int i = 1; i < n; i++) { cin >> t; tmp[t-1] = i; } memset(dp, 0, sizeof(dp)); for(int i = 0; i < n; i++) { for(int j = 0; j < n; j++) { if(a[j] == tmp[i]) dp[i+1][j+1] = dp[i][j] + 1; else dp[i+1][j+1] = max(dp[i][j+1], dp[i+1][j]); } } printf("%d\n", dp[n][n]); } return 0; }
Ê×Ò³
ÉÏÒ»Ò³
1
2
ÏÂÒ»Ò³
βҳ
2
/2/2