标签:
#include <stdio.h>
#include <algorithm>
#include <stdlib.h>
#include <set>
#include <iostream>
#include <map>
#include <cmath>
using namespace std;
/*
int cmp( const void *a, const void *b)
{
return *(int *)a-*(int *)b;
}
*/
int main()
{
int T;
while( ~scanf("%d", &T) )
while(T--)
{
int n,k;
scanf("%d %d", &n, &k );
int num[1010];
set <int > result;
for(int i=1; i<=n; i++)
scanf("%d", &num[i] );
for(int i=1; i<n; i++)
{
for(int j=i+1; j<=n ;j++)
result.insert(abs(num[i]-num[j] ) );
}
std::set<int>::iterator it;
int count=0;
/*for(it = result.begin(); it!=result.end(); it++)
{
if( ++count == k)
cout << *it << endl;
}*/
it = result.begin();
it = it + k;
}
}
标签:
原文地址:http://www.cnblogs.com/sober-reflection/p/30acb5aca74d01b58760cbbc49e19a68.html