Ejemplo n.º 1
0
// Driver program to test above funtion
int main() {
    int arr[] = {3, 1, 1, 2, 2, 1};
    int n = sizeof(arr) / sizeof(arr[0]);
    if (findPartiion(arr, n) == true)
        printf("Can be divided into two subsets of equal sum");
    else
        printf("Can not be divided into two subsets of equal sum");
    getchar();
    return 0;
}
Ejemplo n.º 2
0
// Driver program to test above funtion
int main()
{
//  int arr[] = {3, 1, 1, 2, 2, 1};
//  int n = sizeof(arr)/sizeof(arr[0]);
    int T,N;
    freopen("input.txt","r",stdin);
    scanf("%d",&T);
    while(T--){
        scanf("%d",&N);
        int arr[N];
        for(int i=0;i<N;i++) scanf("%d",&arr[i]);
  if (findPartiion(arr, N) == true)
     printf("YES\n");
  else
     printf("NO\n");
    }
  return 0;
}