网站制作有哪些企业,网站设计弹窗,做的好的招投标网站,什么是内容管理系统题目#xff1a;
3.字符迁移【算法赛】 - 蓝桥云课 (lanqiao.cn)
思路#xff1a; 此题通过把小写字母映射成数字#xff0c;进行差分即可。 AC代码#xff1a;
#includeiostream
#includecstring
#includealgorithmusing namespace std;typed…题目
3.字符迁移【算法赛】 - 蓝桥云课 (lanqiao.cn)
思路 此题通过把小写字母映射成数字进行差分即可。 AC代码
#includeiostream
#includecstring
#includealgorithmusing namespace std;typedef long long LL;
const int N 2e5 10;
LL c[N],b[N];
// 差分
void insert(LL l,LL r,LL k) {b[l] k;b[r1] - k;return;
}int main() {cin.tie(0)-ios::sync_with_stdio(false);LL n,q;cin n q;string str;cin str;for(int i0; istr.size(); i){c[i1]str[i]-a;insert(i1,i1,c[i1]);}while(q--) {int l,r,k;cin l r k;//k%26; 可写可不写insert(l,r,k);}for(int i1; in; i) {b[i] b[i-1]; //前缀和cout (char)(ab[i]%26);}return 0;
}