DFS模板

FisherKK edited 9 月,3 周前

    void DFS(int i, int count, LL s) {
    if (count == k) {
        if (isPrime(s)) sum++;
        return;
    }
    for (int h = i; h < n; h++) 
        DFS(h + 1, count + 1, s + arr[h]);
}

Past Versions

Comments