Lang:G++
Edit12345678910111213141516171819202122232425262728293031#include<malloc.h>int main(){int n,m,t;scanf("%d",&t);int*array;int ans;for(int tt=0;tt<t;tt++){scanf("%d%d",&n,&m);ans=0;array=(int*)malloc(n*sizeof(int));int i;for(i=0;i<n;i++)scanf("%d",&array[i]);if(n<=m)ans=100;else{ans=array[m]-1;for(int kk=0;kk<n-m-1;kk++)if(array[kk+m+1]-array[kk]>ans)ans=array[kk+m+1]-array[kk]-1;if(100-array[n-m]>ans)ans=100-array[n-m];}printf("%d\n",ans);free(array);