首页 > 其他分享 >Codeforces897A-Scarborough Fair

Codeforces897A-Scarborough Fair

时间:2022-11-22 20:02:47浏览次数:60  
标签:Fair Codeforces897A d% int input c2 Scarborough include c1


A. Scarborough Fair

time limit per test

memory limit per test

input

output

Are you going to Scarborough Fair?

Parsley, sage, rosemary and thyme.

Remember me to one who lives there.

He once was the true love of mine.

Willem is taking the girl to the highest building in island No.28, however, neither of them knows how to get there.

Willem asks his friend, Grick for directions, Grick helped them, and gave them a task.

Although the girl wants to help, Willem insists on doing it by himself.

n.

m operations, each operation has four parameters l, r, c1, c2, which means that all symbols c1 in range [l, r] (from l-th to r-th, including l and r) are changed into c2. String is 1-indexed.

m

Input

n and m (1 ≤ n, m ≤ 100).

s of length n, consisting of lowercase English letters.

m lines contains four parameters l, r, c1, c2 (1 ≤ l ≤ r ≤ nc1, c2

Output

s after performing m


Examples



input



3 1 ioi 1 1 i n



output



noi



input



5 3 wxhak 3 3 h x 1 5 x a 1 3 w g



output



gaaak


Note



For the second example:

wxxak.

waaak.

gaaak.

水题……

Code:

#include<iostream>
#include<cmath>
#include<algorithm>
#include<cstring>
#include<cstdio>
#include<cstdlib>
using namespace std;
char s[105];
int main()
{
int n,m;
scanf("%d%d",&n,&m);
scanf("%s\n",&s);
for(int i=1;i<=m;i++)
{
int x,y;char a,b;
scanf("%d%d%c%c%c%c",&x,&y,&a,&a,&b,&b);
for(int j=x;j<=y;j++)
if(s[j-1]==a)s[j-1]=b;
}
printf("%s\n",s);
return 0;
}


标签:Fair,Codeforces897A,d%,int,input,c2,Scarborough,include,c1
From: https://blog.51cto.com/u_15888102/5878416

相关文章

  • Codeforces864A-Fair Game
    FairGamePetyaandVasyadecidedtoplayagame.Theyhave n cards(nBeforethegamePetyawillchooseanintegerandafterthatVasyawillchooseanotherint......
  • 【五期梁锐】CCF-A, (TPDS'20)Towards Fair and Privacy-Preserving Federated Deep Mod
    L.Lyuetal.,"TowardsFairandPrivacy-PreservingFederatedDeepModels,"inIEEETransactionsonParallelandDistributedSystems,vol.31,no.11,pp.25......
  • UESTC 1270 Playfair
    DescriptionPlayfairisakindofsubstitutioncipher.Andtheencryptionroleissimple.Ingeneral,therearethreestepsinPlayfairalgorithm.Step1:Crea......
  • Fairness without Demographics through Adversarially Reweighted Learning
    目录概符号说明本文方法代码LahotiP.,BeutelA.,ChenJ.,LeeK.,ProstF.,ThainN.,WangX.andCHiE.H.Fairnesswithoutdemographicsthroughadversariall......
  • Fair Numbers CodeForces - 1465B
    FairNumbersCodeForces-1465B我们定义一个好数规则如下:它能够整除自己的每一个非零位。例如说,102是一个好数,因为它能整除1和2。282则不是,因为它不能整除8。......
  • FastCorrect&Fairseq学习笔记
    一工作说明:FastCorrect,字面意思就是快速纠错;这项主要是对asr的识别结果进行纠错,提升识别率;目前大部分的纠错模型采用了基于注意力机制的端到端自回归模型(seq2se......
  • ABC264 G - String Fair
    DP+最短路+哈希G-StringFair(atcoder.jp)题意给若干个只包含小写字母的长度<=3的字符串\(T_i\),每个字符串有权值构造一个非空字符串S,若S中包含上述子串,则......
  • FairyGUI窗口拖动,关闭,加载图片
    1.在FairyGUI软件里面制作好窗口window的格式,按照官网上的来关闭按钮:closeButton、拖动范围:dragArea、步骤:1.新建一个空组件2.再建一个空组件命名为:frame3.frame组件......