func_code_string: #include <bits/stdc++.h>   using namespace std;   const int maxn = 3e5 + 100;   const int maxK = 5000 + 10;   const long long INF = 1e18;   int a[maxn], n, k;   long long f[maxK][maxK];   long long gao(int i, int j, int len) {     int s = i * (n / k) + j * (n / k + 1) + 1;     int t = s + len - 1;     return a[t] - a[s];   }   void solve() {     sort(a + 1, a + 1 + n);     int ni = k - n % k;     int nj = n % k;     f[0][0] = 0;     for (int i = 0; i <= ni; i++) {       for (int j = 0; j <= nj; j++) {         if (i == 0 && j == 0) continue;         f[i][j] = INF;         if (i >= 1) {           f[i][j] = min(f[i][j], f[i - 1][j] + gao(i - 1, j, n / k));         }         if (j >= 1) {           f[i][j] = min(f[i][j], f[i][j - 1] + gao(i, j - 1, n / k + 1));         }       }     }     printf( %I64d n , f[ni][nj]);   }   int main() {     while (scanf( %d%d , &n, &k) != EOF) {       for (int i = 1; i <= n; i++) scanf( %d , &a[i]);       solve();     }     return 0;   }   