(不懂就问)为什么只能得95?

#include<cstdio>
using namespace std;
struct T{
	int f;//方向
	char name[15];
}p[100010];
int main(){
	int n,m,top=1;//top当前编号
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;i++){
		scanf("%d%s",&p[i].f,&p[i].name);
	}
	for(int i=1;i<=m;i++){
		int a,s;
		scanf("%d%d",&a,&s);
		if(p[top].f+a==1) top+=s;
		else top-=s;
		if(top>n) top-=n;
		if(top<0) top+=n;
	}
	printf("%s",p[top].name);
	return 0;
}
全部评论
你仔细考虑下第 19 行?
点赞 回复 分享
发布于 2021-07-08 21:04

相关推荐

评论
1
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务