救命!AC率仅为60%!大佬求救!
查看原帖
救命!AC率仅为60%!大佬求救!
487161
kksc02楼主2021/5/30 16:58

思路完全正确,但是就不知道哪里错了,AC仅为60%

求大佬指点!(蒟蒻。。。。。。)

我本来以为这个题目非常简单。。。

//P1563
#include <bits/stdc++.h>
using namespace std;
 
//每个小人的基本信息
struct villain{
	bool orientation;//朝向圈外为true  
	string name;
};
villain vill[10000000];
//每个指令的基本信息
struct operation{
	bool turn;//向右为true 
	int move;
}; 
operation oper[10000000];
int who=1;//到底是谁 

int main(){
	int num_a,num_b;//小人数和指令数
	cin>>num_a>>num_b;
	for (int k=1;k<=num_a;k++)
		cin>>vill[k].orientation>>vill[k].name;
	for (int k=1;k<=num_b;k++)
		cin>>oper[k].turn>>oper[k].move;
	for(int k=1;k<=num_b;k++){
		if (vill[k].orientation+oper[k].turn==1)who=who+oper[k].move;
		else who=who-oper[k].move;
		//移动
		while(who<1||who>num_a){
		if(who<1)who=who+num_a;
		if(who>num_a)who=who-num_a; 
		}
	}
	cout<<vill[who].name;
	return 0;
}
注:2 6 8 10 13 15 17 19显示WA
给的例一原应该输出writer 实际输出thinker
2021/5/30 16:58
加载中...