/*This Code is Submitted by billforum for Problem 1965 at 2012-02-06 21:00:43*/#includeusing namespace std;const int NUM=1442;//the number of the most carsint m[NUM+1],step[NUM+1],tmp[NUM+1],pre[NUM+1];int max(int x,int y){ return(x>y?x:y);}int main(int args,char** argv){ int time,lim,num,test; cin>>test; while(test--) { cin>>lim>>time>>num; for(int i=1;i<=num;i++) { cin>>tmp[i]; //step[i]=0; m[i]=-1; //min[i]=tmp[i]+time; } m[0]=-time;// //step[0]=0; m[1]=tmp[1]+time; pre[1]=0; //step[1]=1; for(int i=2;i<=num;i++) { int maxn=100000000; for(int j=1;(j<=lim)&&(i-j>=0);j++) { int t=max(m[i-j]+time,tmp[i])+time;//!!!!!!! if(t<=maxn) { maxn=t; m[i]=t; //step[i]=step[i-j]+1; pre[i]=i-j; } } } int ans=0,id=num; while(pre[id]!=0) { ans++; id=pre[id]; } ans++; cout< <<" "< <