【链接】
hdu6147
【题目大意】
看题面可以理解。博主已经懒得打了
【解题报告】
经过日复一日,年复一年的画图终究得出这题是道规律题woc!!!!!
如果路线相交只会出现两种情况,如下:
所以只需要判一判就出结果了。
#include<cstdio>
#define LL long long
using namespace std;
const int maxn=1000005;
int T,n,ans,a[maxn];
inline int Read()
{
int res=0;
char ch=getchar();
while (ch<'0'||ch>'9') ch=getchar();
while (ch>='0'&&ch<='9') res=res*10+ch-48,ch=getchar();
return res;
}
void Work()
{
n=Read();
for (int i=1; i<=n; i++) a[i]=Read();
for (int i=4; i<=n; i++)
if ((a[i]>=a[i-2]&&a[i-1]<=a[i-3])||
(i>=6&&a[i-3]>=a[i-1]&&a[i-2]>=a[i-4]&&a[i-1]+a[i-5]>=a[i-3]&&a[i]+a[i-4]>=a[i-2])||
(i>=5&&a[i-1]==a[i-3]&&a[i]<=a[i-2]&&a[i]+a[i-4]>=a[i-2])) {printf("%d\n",i); return;}
printf("Catch you\n");
}
int main()
{
freopen("6147.in","r",stdin);
freopen("6147.out","w",stdout);
T=Read();
while (T--) Work();
return 0;
}