天行常
天行常
全部文章
分类
题解(5)
归档
标签
去牛客网
登录
/
注册
天行常的博客
全部文章
(共5篇)
题解 | #密码截取#
很经典的动态规划求最长回文串长度的问题 ">using namespace std; int solve(string s){ int res = 0; int length = s.size(); if(length == 1) return 1; vector&l...
C++
2022-03-07
0
189
题解 | #记票统计#
原本想使用map容器做,想用下find函数,结果忘了题目里要求输出顺序要和输入顺序一样, 不过后来还是补充了一个vector过了 #include<bits/stdc++.h> using namespace std; int main(){ int n=0;int m = 0...
C++
2022-02-27
5
291
题解 | #最长回文子串#
采取动态规划的形式 ">using namespace std; bool p[355][355]; int main(){ string s; while(cin>>s){ int start = 0; int length = 1; ...
C++
2022-02-27
0
250
题解 | #字符串分隔#
思路很简单,在string之后补0 以达到8的倍数。然后用substr截取输出 #include<bits/stdc++.h> using namespace std; int main(){ string s; while (getline(cin,s)){ int lengt...
C++
2022-02-26
0
244
题解 | #参数解析#
我的思路比较简单也容易理解 给字符串里的每个字符标记属性flag 可以理解为 flag为0 即为文本字符 flag为1 即为分割字符 那么需要排除的就是引号内的空格,将其flag不置为1; #include <iostream> #include <vector> #in...
C++
2022-02-13
2
380