随笔分类 - 字符串
字符串
摘要:题目传送门 #include <bits/stdc++.h> using namespace std; int n = 4; string s; unordered_map<char, int> _map; int main() { //读入并记录 while (n--) { getline(cin
阅读全文
摘要:题目传送门 #include <bits/stdc++.h> using namespace std; int a[3]; char s1, s2; int main() { //充分利用c++语言优势 while (scanf("%c:=%c;", &s1, &s2) == 2) //赋值语句简洁
阅读全文
摘要:题目传送门 #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
阅读全文
摘要:题目传送门 #include<bits/stdc++.h> using namespace std; //原始英文数字 // You are a three eight pig . 10964 unordered_map<string, int> _map = {{"zero", 0}, {"one
阅读全文
摘要:题目传送门 #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
阅读全文
摘要:题目传送门 #include<bits/stdc++.h> using namespace std; int boy, girl;//存放答案滴 string x; //这道题太无聊了~ int main() { cin >> x; for (int i = 0; i < x.length(); i
阅读全文
摘要:题目传送门 #include <bits/stdc++.h> using namespace std; int maxN; /** * 功能:获取字符串中有多少个VK */ int getVkCount(string s) { int cnt = 0; for (int i = 0; i < s.l
阅读全文
摘要:题目传送门 #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
阅读全文
摘要:题目传送门 一、知识点整理 1、字符串转小写 //转为小写 transform(a.begin(), a.end(), a.begin(), ::tolower); for (int i = 0; i < b.size(); i++) if (b[i] >= 'A' && b[i] <= 'Z')
阅读全文
摘要:题目传送门 #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
阅读全文
摘要:题目传送门 #include <bits/stdc++.h> using namespace std; string s; int c; int main() { while (cin >> s) c += s.size(); printf("%d", c); return 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两个函数的
阅读全文
摘要:题目传送门 #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
阅读全文
摘要:题目传送门 #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
阅读全文
摘要:题目传送门 #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
阅读全文
摘要:题目传送门 一、大力出奇迹,爆搜过样例 开始想的是先把所有字符串按照字典序升序(由小到大)排一下,然后从前向后以每一个单词为起点爆搜一下, 第一个得到的答案就是字典序最小的答案,这个做法是对的,但是会被卡掉,因为复杂度比较高。 关键词:字符串数组+排序+爆搜 结果:80分,2个点掉 完整代
阅读全文
摘要:题目传送门 C++代码 #include<bits/stdc++.h> using namespace std; const int N = 10; string ar[N]; //由啥 string br[N]; //变成啥 int n; //规则个数 string a, b; //原串,目标串
阅读全文
摘要:题目传送门 C++代码 #include <bits/stdc++.h> using namespace std; const int INF = 0x3f3f3f3f; const int N = 30; string a[N * 2]; int res; //最大长度 char start; /
阅读全文