Guest User

Untitled

a guest
Nov 24th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.74 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <math.h>
  4. #include <stdlib.h>
  5. #include <ctype.h>
  6.  
  7. int niz[2000000];
  8.  
  9. int main()
  10. {
  11.     int t, n, m, tre, i, poz, rj, j, k, pom;
  12.     scanf ("%d", &t);
  13.     for (i = 0; i < t; i++){
  14.         rj = 0;
  15.         poz = 1;
  16.         scanf ("%d %d", &n, &m);
  17.         niz[0] = m;
  18.         for (j = 0; j < n; j++){
  19.             scanf ("%d", &tre);
  20.             pom = poz;
  21.             if (rj == 0){
  22.                 for (k = 0; k < pom; k++){
  23.                     niz[poz] = niz[k] - tre;
  24.                     if (niz[poz] == 0) rj = 1;
  25.                     poz++;
  26.                 }
  27.             }  
  28.         }
  29.         if (rj == 1) printf ("Yes\n");
  30.         else printf ("No\n");  
  31.     }
  32.     return 0;
  33. }
Add Comment
Please, Sign In to add comment