题意:求循环的长度。。
思路:一开始想用结构体来做,没得到一个L就flag一下表示访问过,不过输入数据就卡住了不得不得不放弃。
后来用了下面这种方法感觉是一样的就是测试数据过不了,有时间在改改试试。。感觉代码1,代码2思路是一样的。不知道错在哪里了。。。
代码1:未过测试数据。。哦原来是数组开小了。。代码1:还有个问题就是But be careful: the cycle might not begin with the seed!数组不一定是从第一个数组开始的所以导致第三组测试数据输出501。。。
#include <iostream>
#include<cstdio>
#include<cstring>
using namespace std;
int a[1010];
int main()
{
}
//代码2:AC
#include<iostream>
#include<cstring>
#include<cstdio>
using namespace std;
const int maxn=10100;
int a[maxn];//数组开大点
int main()
{
}