Skip to content

Instantly share code, notes, and snippets.

@Thiago4532
Created August 7, 2019 15:35
Show Gist options
  • Select an option

  • Save Thiago4532/a58db394778d484769f87b090ca6c871 to your computer and use it in GitHub Desktop.

Select an option

Save Thiago4532/a58db394778d484769f87b090ca6c871 to your computer and use it in GitHub Desktop.
// iterando em todas as mask's
for (int mask = 0; mask < (1<<n); mask++){
F[mask] = A[0];
// iterando em todos os subconjuntos de mask
for(int i = mask; i > 0; i = (i-1) & mask){
F[mask] += A[i];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment