题目链接:http://www.wikioi.com/problem/1029/
算法:DP
本题有个2小技巧。
那么答案就好求啦~
代码:
1
2
3
4
5
6
7
8
9
10
11
12 |
#include <iostream> #include <string> using
namespace
std; int
i, j, s, c; int
main() { string a, b; cin >> a >> b; s = a.size(); for (i = 1; i < s; ++i) for (j = s-2; j >= 0; --j) if (a[i] == b[j] && a[i-1]==b[j+1]) c++; cout << (1<<c); return
0; } |
原文:http://www.cnblogs.com/iwtwiioi/p/3538833.html