func_code_string: #include <bits/stdc++.h>   using namespace std;   int arr[100005];   long long sum[100005];   map<int, long long> f;   long long solve(int n, int k) {     if (f.count(k)) return f[k];     long long ret = 0;     long long cur = n - 2;     long long p = k;     while (cur >= 0) {       ret += sum[cur];       cur -= p;       p *= k;     }     return f[k] = ret;   }   int main() {     int n;     scanf( %d , &n);     for (int i = 0; i < n; ++i) scanf( %d , &arr[i]);     sort(arr, arr + n);     sum[0] = arr[0];     for (int i = 1; i < n; ++i) sum[i] = sum[i - 1] + arr[i];     int q, a;     scanf( %d , &q);     for (int i = 0; i < q; ++i) {       scanf( %d , &a);       if (i) printf(   );       printf( %I64d , solve(n, a));     }     printf(  n );     return 0;   }   