首页
DreamJudge
院校信息
考研初试
机试真题
讨论区
兑换中心
登录
注册
上岸
以下题解仅供学习参考使用。
抄袭、复制题解,以达到刷AC率/AC数量或其他目的的行为,在N诺是严格禁止的。
N诺非常重视学术诚信。此类行为将会导致您成为作弊者。具体细则请查看N诺社区规则。
123456608
2025年2月27日 19:27
求解:哪里错了捏只有75%通过率
P1627
回复 1
|
赞 1
|
浏览 463
#include<bits/stdc++.h> using namespace std; int main(){ string a,b; while(cin>>a>>b){ int x=0,y=0; int l1=a.length(); int l2=b.length(); vector<vector<int> > dp(l1+1,vector<int>(l2+1,0)); for(int i=1;i<=l1;i++){ for(int j=1;j<...
jsd
2025年1月22日 15:58
P1627 上交2018 Problem B 答疑提问:
P1627
回复 2
|
赞 2
|
浏览 308
还是只有50%的通过率,在线求助题1627 #include<bits/stdc++.h> using namespace std; int main() { string s1, s2; while(cin>>s1>>s2) { vector<vector<int> > dp(1001, vector<int>(1001, 0)); &nbs...
brandon_hu
2021年3月19日 21:16
蛮力破解,没啥好说的
P1627
回复 0
|
赞 1
|
浏览 9.0k
#include<iostream> #include<cstdio> #include<string> #include<algorithm> #include<vector> #include<cctype> using namespace std; int main() { string a, b; while (cin >> a >> b) { &n...
cobread
2021年3月3日 14:51
疑似样例错误
P1627
回复 0
|
赞 1
|
浏览 7.4k
这一组样例 aaaaaqaqaqaqaqaqaqaq aqaqaqsqsqqaqaqaqaq ``` #include <iostream> #include <string> #include <algorithm> #include <cstring> using namespace std; const int N = 1010; int f[N][N]; int main() { string s1, s2; while(ci...
hrcarryu
2021年2月28日 23:24
算法笔记原题
P1627
回复 0
|
赞 0
|
浏览 7.9k
如题
_lz
2020年4月9日 16:51
蓝翔研究生
P1627
回复 0
|
赞 0
|
浏览 9.3k
#include #include using namespace std; const int maxn = 1000; char a[maxn], b[maxn]; int dp[maxn][maxn]; int main(){ //dp[i][j] == dp[i-1][j-1] + 1; a[i] == b[j] // == 0; while(scanf("%s ...
机试帐号
2020年3月23日 11:41
最长公共子串
P1627
回复 0
|
赞 3
|
浏览 11.3k
最开始看成了序列,搞了半天没通过。 这里我用了两个for循环,复杂度还是比较高 思路很简单,外层是第一个字符串一次遍历,内层是对第二个子串的循环。 这里有几个细节: 1.这里要求输出,对于子串倒是不难,长度容易求,记录首地址即可,对于子序列就比较麻烦,我想的是用一个二维数组来存储对应的dp[i][j]比较简单, 当然,这样空间复杂度比较高; 2.这里我没有采用动态规划,内层循环一开始如果用for循环也行,for(int j = 0;j< t.length();j++)这样在退出循环时,要更新j的值; 我用的while循环,感觉走偏了,值的更...
题目
最长公共子串3
题解数量
7
发布题解
在线答疑
热门题解
1
最长公共子串
2
P1627 上交2018 Problem B 答疑提问:
3
疑似样例错误
4
蛮力破解,没啥好说的
5
求解:哪里错了捏只有75%通过率
6
算法笔记原题
7
蓝翔研究生