- 过河
- 2014-03-01 22:20:45 @
#include<iostream>
using namespace std;
int l,s,t,m,x;
int len(int b[],int v)
{
int p=v+s,st(s),min(9999999);
while(st<=t)
{
if (p<=l)
{
if (min>(b[p]+b[v]))
{
min=(b[p]+b[v]);
}
}
p++;
st++;
}
return min;
}
int main()
{
cin >>l;
cin >>s>>t>>m;
int i;
int b[l+1];
for(i=0;i<=l;i++)
{
b[i]=0;
}
for (i=1;i<=m;i++)
{
cin >>x;
b[x]=1;
}
for (i=l-1;i>=0;i--)
{
b[i]=len(b,i);
}
cout <<b[0];
}
2个 ac
1个 wrong
6个 runtime error