字符串
SSL_kyx
简~介
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
YbtOJ——字符串处理【例题5】生日相同
E. 【例题5】生日相同 题目 代码 #include<iostream> #include<cstring> using namespace std; string s,s1,s2; int l1,l2; void in() { cin>>s, s1=s+s;//模拟首尾相连的环 cin>>s, s2=s+s;//模拟首尾相连的环 l1=s1.size(); l2=s2.size(); if(l1>l2)//短的在前,长的在后 { s原创 2021-07-08 11:44:35 · 263 阅读 · 0 评论 -
YbtOJ——字符串处理【例题4】字符串环
D. 【例题4】字符串环 题目 将源输入的字符串复制一份插到后面,模拟首尾相连的环。 然后查找连续公共子串即可。 代码 #include<iostream> #include<cstring> using namespace std; string s,s1,s2; int l1,l2; void in() { cin>>s, s1=s+s;//模拟首尾相连的环 cin>>s, s2=s+s;//模拟首尾相连的环 l1=s1.size(); l2=s原创 2021-07-08 11:31:18 · 221 阅读 · 0 评论 -
YbtOJ——字符串处理【例题3】单词替换
C. 【例题3】单词替换 题目 被输入坑了几次,OJ上测是不能直接getline的。 我用了一种比书上简单点的方法,注释里看。 代码 #include<iostream> #include<cstring> using namespace std; string s[100001],a,b; int n; void in() { char space; do { cin>>s[++n];//输入单词 space=getchar();//输入空格 } w原创 2021-07-08 09:58:30 · 180 阅读 · 0 评论 -
YbtOJ——字符串处理【例题2】移位包含
B. 【例题2】移位包含 题目 题解 设长度长的一个字符串为s1s1s1,短的为s2s2s2。 枚举s1s1s1的移位,对于它的每一次移位,判断s2s2s2是否为其的子串。 代码 #include<iostream> #include<cstring> using namespace std; string s1,s2; int l1,l2; int main() { int n; cin>>s1>>s2; l1=s1.size(); l2=s2.s原创 2021-06-13 16:46:09 · 142 阅读 · 0 评论 -
YbtOJ——字符串处理【例题1】数字反转
A. 【例题1】数字反转 题目 题解 有点困,于是在YbtOJ找了道水题,但也让我学到了点东西: sprintf(原创 2021-06-13 16:13:40 · 178 阅读 · 1 评论
分享