随笔分类 - 字符串
摘要:解析 字符串操作,本题解采取了多关键词排序 Code #include <bits/stdc++.h> using namespace std; int f, n; struct node { int y, r; string s; }a[100005]; int cmp (node x, node
阅读全文
摘要:解析 字符串的操作,可以用函数解决这个问题 s 2. f i n d ( s 1. s u b s t r ( i , j ) ) s2.find~(s1.substr~(i,~j)) s2.find (s1.substr (i, j)) 在s2中查找s1中 i i i到 j j j第一次出现的位置
阅读全文
摘要:C . 【 例 题 3 】 单 词 替 换 解析 可以一个个单词读取,输入完之后, 讲整个句子的每个单词遍历一次, 如果这个单词是与单词 a a a相同的话, 就输出 b b b, 否则输出这个单词 Code #include <bits/stdc++.h> using namespace std;
阅读全文
摘要:解析 判断是否是子串,可以将这个一个环 #include <bits/stdc++.h> using namespace std; int f = 0; string a, b; int main() { cin >> a >> b; for (int i = 0; i < a.size (); +
阅读全文
摘要:题目解析 字符串的基础操作,注意判断零即可 #include <bits/stdc++.h> using namespace std; int i; char c[15]; int main () { scanf ("%s", &c); if (c[0] == '-') { i = 1; print
阅读全文