随笔分类 -  字符串

字符串
摘要:HDU 1711 Number Sequence 题目链接 HDU 1711 Number Sequence 一、题目大意 给一段长度为n的整数s1以及相对较小长度为m的整数s2,问在s1s2第一个成功匹配的位置在哪?不存在输出1阅读全文
posted @ 2022-08-04 16:03 糖豆爸爸 阅读(33) 评论(0) 推荐(0) 编辑
摘要:题目传送门 #include <bits/stdc++.h> using namespace std; int n = 4; string s; unordered_map<char, int> _map; int main() { //读入并记录 while (n--) { getline(cin 阅读全文
posted @ 2021-11-18 11:02 糖豆爸爸 阅读(67) 评论(0) 推荐(0) 编辑
摘要:题目传送门 #include <bits/stdc++.h> using namespace std; int a[3]; char s1, s2; int main() { //充分利用c++语言优势 while (scanf("%c:=%c;", &s1, &s2) == 2) //赋值语句简洁 阅读全文
posted @ 2021-11-18 10:59 糖豆爸爸 阅读(128) 评论(0) 推荐(0) 编辑
摘要:题目传送门 #include<bits/stdc++.h> using namespace std; string a; string b; int main() { cin >> a >> b; int sum1 = 1; for (int i = 0; i < a.size(); i++) su 阅读全文
posted @ 2021-11-18 10:42 糖豆爸爸 阅读(61) 评论(0) 推荐(0) 编辑
摘要:题目传送门 #include<bits/stdc++.h> using namespace std; //原始英文数字 // You are a three eight pig . 10964 unordered_map<string, int> _map = {{"zero", 0}, {"one 阅读全文
posted @ 2021-11-18 10:38 糖豆爸爸 阅读(115) 评论(0) 推荐(0) 编辑
摘要:题目传送门 #include<bits/stdc++.h> using namespace std; /** 0.000009->0.9 0.900000->0.000009 00000.00000->0.0 0/1230000->0/321不是0也不是0/0000321 000000000->0 阅读全文
posted @ 2021-11-18 10:35 糖豆爸爸 阅读(115) 评论(0) 推荐(0) 编辑
摘要:题目传送门 #include<bits/stdc++.h> using namespace std; int boy, girl;//存放答案滴 string x; //这道题太无聊了~ int main() { cin >> x; for (int i = 0; i < x.length(); i 阅读全文
posted @ 2021-11-18 10:29 糖豆爸爸 阅读(66) 评论(0) 推荐(0) 编辑
摘要:题目传送门 #include <bits/stdc++.h> using namespace std; int maxN; /** * 功能:获取字符串中有多少个VK */ int getVkCount(string s) { int cnt = 0; for (int i = 0; i < s.l 阅读全文
posted @ 2021-11-18 10:27 糖豆爸爸 阅读(73) 评论(0) 推荐(0) 编辑
摘要:题目传送门 #include <bits/stdc++.h> using namespace std; const int N = 26; //常数字典 int a[N] = {1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 4, 1, 2 阅读全文
posted @ 2021-11-18 10:23 糖豆爸爸 阅读(52) 评论(0) 推荐(0) 编辑
摘要:题目传送门 一、知识点整理 1、字符串转小写 //转为小写 transform(a.begin(), a.end(), a.begin(), ::tolower); for (int i = 0; i < b.size(); i++) if (b[i] >= 'A' && b[i] <= 'Z') 阅读全文
posted @ 2021-11-18 10:13 糖豆爸爸 阅读(308) 评论(0) 推荐(0) 编辑
摘要:题目传送门 #include <bits/stdc++.h> using namespace std; string s, a; int n; int opt; int l, cnt; int main() { cin >> n >> s; while (n--) { cin >> opt; swi 阅读全文
posted @ 2021-11-18 10:00 糖豆爸爸 阅读(159) 评论(0) 推荐(0) 编辑
摘要:题目传送门 #include <bits/stdc++.h> using namespace std; string s; int c; int main() { while (cin >> s) c += s.size(); printf("%d", c); return 0; } 阅读全文
posted @ 2021-11-18 09:51 糖豆爸爸 阅读(42) 评论(0) 推荐(0) 编辑
摘要:题目传送门 #include <bits/stdc++.h> using namespace std; char c;//操作符 int n, a, b; char s[100]; int main() { cin >> n; while (n--) { //学习scanf和sprintf两个函数的 阅读全文
posted @ 2021-11-18 09:48 糖豆爸爸 阅读(101) 评论(0) 推荐(0) 编辑
摘要:题目传送门 #include <bits/stdc++.h> using namespace std; const int N = 30; const int INF = 0x3f3f3f3f; int Max, Min = INF; int b[N]; //计数数组 bool IsPrime(in 阅读全文
posted @ 2021-11-18 09:42 糖豆爸爸 阅读(144) 评论(0) 推荐(0) 编辑
摘要:题目传送门 #include <bits/stdc++.h> using namespace std; int n; string s; int main() { cin >> n >> s; for (int i = 0; i < s.size(); i++) { int c = s[i] + n 阅读全文
posted @ 2021-11-18 09:34 糖豆爸爸 阅读(124) 评论(0) 推荐(0) 编辑
摘要:题目传送门 #include <bits/stdc++.h> using namespace std; int main() { string s; cin >> s; //方式1 for (int i = 0; i < s.size(); i++) printf("%c", toupper(s[i 阅读全文
posted @ 2021-11-18 09:27 糖豆爸爸 阅读(175) 评论(0) 推荐(0) 编辑
摘要:题目传送门 一、大力出奇迹,爆搜过样例 开始想的是先把所有字符串按照字典序升序(由小到大)排一下,然后从前向后以每一个单词为起点爆搜一下, 第一个得到的答案就是字典序最小的答案,这个做法是对的,但是会被卡掉,因为复杂度比较高。 关键词:字符串数组+排序+爆搜 结果:80分,2个点TLE掉 完整代 阅读全文
posted @ 2021-08-13 08:20 糖豆爸爸 阅读(258) 评论(0) 推荐(2) 编辑
摘要:题目传送门 C++代码 #include<bits/stdc++.h> using namespace std; const int N = 10; string ar[N]; //由啥 string br[N]; //变成啥 int n; //规则个数 string a, b; //原串,目标串 阅读全文
posted @ 2021-07-28 14:26 糖豆爸爸 阅读(50) 评论(0) 推荐(0) 编辑
摘要:题目传送门 C++代码 #include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int N = 30; string a[N * 2]; int res; //最大长度 char start; / 阅读全文
posted @ 2021-07-28 09:58 糖豆爸爸 阅读(68) 评论(0) 推荐(0) 编辑

Live2D
点击右上角即可分享
微信分享提示