首页 > 游游的字母翻倍
头像 Lambda_L
发表于 2025-12-16 01:11:20
解题思路直接模拟每次操作的过程:每次操作先将 1-based 的区间 [l, r] 转换为 0-based 索引计算区间长度,从区间末尾向前遍历(避免插入操作影响后续字符的位置) 假设区间是 [2,4](0-based 是 [1,3]),字符是 b、c、d 如果从左到右插 展开全文
头像 realrole
发表于 2025-12-16 13:08:06
#include <iostream> #include<string> using namespace std; int main() { int n,q;cin>>n>>q; string s;cin>>s; 展开全文
头像 Silencer76
发表于 2025-12-16 09:37:10
字符串模拟 n,q=map(int,input().split()) s='?'+input() for _ in range(0,q): l,r=map(int,input().split()) s1=s[:l] s2=s[l:r+1] s3=s[r+1:] 展开全文
头像 YunBaichuan
发表于 2025-12-16 09:56:45
思路:模拟题,算一下时间复杂度可以得到是。由于q只有10,那么量级就是,为,完全可以通过 tips:Python3处理字符串的效率高于PyPy3,因此这题用Python3跑的速度快于PyPy3 代码: import sys input = lambda: sys.stdin.readline().s 展开全文
头像 quchen666
发表于 2025-12-16 10:55:07
#include <bits/stdc++.h> using namespace std; int main() { int n,q; cin>>n>>q; string s; cin>>s; while(q-- 展开全文
头像 在海里blueblue
发表于 2025-12-16 12:31:28
#include <bits/stdc++.h> using namespace std; // 模拟 字符串 int main() { int n, q, l, r; string str; cin >> n >> q; cin 展开全文
头像 CodingKnight
发表于 2025-12-05 13:38:32
模拟 每次分割字符串,先用前半段完成复制操作 再组合成新字符串 #include <bits/stdc++.h> using namespace std; #define ll long long #define fi first #define se second #define pb 展开全文
头像 RogeAustine
发表于 2025-12-16 07:59:15
#include <iostream> using namespace std; void solve() { int n,q;cin>>q>>q; string s;cin>>s; while (q--) { 展开全文
头像 花碗
发表于 2025-12-16 10:53:00
#include <iostream> #include<cstring> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.t 展开全文
头像 1_1_4_5_1_4
发表于 2025-12-16 11:01:28
#include <iostream> #include <string> using namespace std; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); i 展开全文