题解(模拟)
2026-02-10 22:28:14
发布于:湖南
0阅读
0回复
0点赞
思路:
纯模拟(不懂模拟的可以理解为就是你在玩这个游戏,你就是游戏人物,你在执行规则就可以了)
#include<bits/stdc++.h>
using namespace std;
string s;
int n,a,cishi=-1,tot=0;
int main() {
getline(cin,s);
scanf("%d",&n);
int length=s.length()-1;
for(int i=1; i<=n; i++) {
scanf("%d",&a);
cishi+=a;
if(cishi>=length) cishi=length-1;
if(s[cishi]=='>'&&s[cishi+1]=='>'&&s[cishi+2]=='>')
while(s[cishi]=='>')cishi++;
else if(s[cishi]=='*'&&s[cishi+1]=='*'&&s[cishi+2]=='*') {
while(s[cishi+tot]=='*')tot++;
cishi-=tot;
}
if(cishi<0)cishi=0;
if(cishi>=length)cishi=length-1;
}
cout<<cishi+1<<' '<<length-1-cishi;
return 0;
}
总结一下:
刚开始的时候他还没有在棋盘上,一定要注意!!(卡了我一上午)
while(s[cishi+tot]=='')tot++;
在判断倒退的时候一定是加上‘’这个符号的格数,不然还是卡一半数据点。
读好题目读好题目读好题目
这里空空如也






有帮助,赞一个