代码是我很久很久以前写的暴力(你甚至可以在这里看到我三年前发的帖),今天重新捡起来交了一下,八个点TLE太正常了,为什么有两个点WA啊?
#include <iostream>
#include <cstdio>
using namespace std;
int main()
{
long N;
cin >> N;
long start = 0;
bool dealed[N];
long R[N];
for(long i=0;i<N;i++)
{
dealed[i]=false;
cin >> R[i];
}
for(long j=0;j<N;j++)
{
for(long i=0;i<R[j];i++)
{
start++;
if (start==N)
{
start = 0;
}
for (;dealed[start];)
{
start++;
if (start==N)
{
start = 0;
}
}
}
cout << (start+1) << endl;
dealed[start] = true;
start++;
if (start==N)
{
start = 0;
}
for (int i=0;i<N;i++)
{
start++;
if (start==N)
{
start = 0;
}
}
}
return 0;
}