这题的题意真是难读懂,,right behind是后面的意思。。
可是这题,求的是坐在你对面的那个人是谁。。
一个多小时题意硬是没懂。。
主要思路,一个圈里,你对面那个人,数过去肯定是总人数的一半。
#include <cstdio>
#include <algorithm>
#include <map>
#include <cstring>
#include <cmath>
#include <iostream>
using namespace std;
#define lson l , m , rt << 1
#define rson m + 1 , r , rt << 1 | 1
#define LL __int64
typedef long long ll;
#define PI 3.1415926
int main()
{
int t,i;
cin>>t;
char s[2222][25];
char s1[25];
char s2[25];
while(t--)
{
int n,m;
cin>>n;
scanf("%s",s1);
if(n%2==0)
m=n/2;
else
m=n/2+1;
for(i=1; i<=n; i++)
scanf("%s",s[i]);
for(i=1; i<=n; i++)
{
if(strcmp(s1,s[i])==0)
{
if(i+m<=n)
{
printf("%s\n",s[(i+m)]);
break;
}
else
{
printf("%s\n",s[(i+m)%n]);
break;
}
}
}
}
return 0;
}